Check Credit Card Validity using Luhn Algorithm
You can freely import the following code: public class Luhn { public static boolean Check(String ccNumber) { int sum = 0; boolean alternate = false; for (int i = ccNumber.length() – 1; i >= 0; i–) { int n = Integer.parseInt(ccNumber.substring(i, i + 1)); if (alternate) { n *= 2; if (n > 9) { … Read more