Luhn algorithm: Difference between revisions

Content deleted Content added
Line 146:
int sum = 0;
int digit = Character.getNumericValue(number.charAt(i));
if (i % 2 == 01) { //indexes go from 0 -> (length-1), so the odd indexes are the even digits
digit *= digit * 2;
}