We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
//--------------------------------------------------------- // Checks for valid credit card number using Luhn algorithm //--------------------------------------------------------- public abstract class LuhnCheck { //-------------------------------- // Filter out non-digit characters //-------------------------------- private static String getDigitsOnly (String s) { StringBuffer digitsOnly = new StringBuffer (); char c; for (int i = 0; i < s.length (); i++) { c = s.charAt (i); if (Character.isDigit (c)) { digitsOnly.append (c); } } return digitsOnly.toString (); } //------------------- // Perform Luhn check //------------------- public static boolean isValid (String cardNumber) { String digitsOnly = getDigitsOnly (cardNumber); int sum = 0; int digit = 0; int addend = 0; boolean timesTwo = false; for (int i = digitsOnly.leng
Original issue reported on code.google.com by [email protected] on 14 Jun 2012 at 11:02
[email protected]
Attachments:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Original issue reported on code.google.com by
[email protected]
on 14 Jun 2012 at 11:02Attachments:
The text was updated successfully, but these errors were encountered: