Я попытался проверить валидацию кредитной карты с использованием алгоритма Луна, который работает следующим образом:
-  
Сдвиньте каждую вторую цифру справа налево. Если удвоение цифры приводит к двузначному числу, добавьте две цифры, чтобы получить одноразрядное число.
2 * 2 = 4
2 * 2 = 4
4 * 2 = 8
1 * 2 = 2
6 * 2 = 12 (1 + 2 = 3)
5 * 2 = 10 (1 + 0 = 1)
8 * 2 = 16 (1 + 6 = 7)
4 * 2 = 8
 -  
Теперь добавьте все однозначные числа из шага 1.
4 + 4 + 8 + 2 + 3 + 1 + 7 + 8 = 37
 -  
Добавьте все цифры в нечетные места справа налево в номере карты.
6 + 6 + 0 + 8 + 0 + 7 + 8 + 3 = 38
 -  
Суммируйте результаты, полученные на шагах 2 и 3.
37 + 38 = 75
 -  
Если результат шага 4 делится на 10, номер карты действителен; в противном случае это неверно. Например, номер 4388576018402626 недействителен, но номер 4388576018410707 действителен.
 
Просто моя программа всегда отображает действительные для всего, что я вводил. Даже если это действительное число и результат методов sumOfOddPlace и sumOfDoubleEvenPlace равны нулю. 
 Приветствуется любая помощь.
import java.util.Scanner;
public class CreditCardValidation {
      public static void main(String[] args) {
     Scanner in = new Scanner(System.in);
        int count = 0;
        long array[] = new long [16];
       do
       {
        count = 0;
       array = new long [16];
        System.out.print("Enter your Credit Card Number : ");
        long number = in.nextLong();
        for (int i = 0; number != 0; i++) {
        array[i] = number % 10;
        number = number / 10;
        count++;
        }
       }
        while(count < 13); 
        if ((array[count - 1] == 4) || (array[count - 1] == 5) || (array[count - 1] == 3 && array[count - 2] == 7)){
            if (isValid(array) == true) {
                System.out.println("\n The Credit Card Number is Valid. ");
        } else {
            System.out.println("\n The Credit Card Number is Invalid. ");
        }
        } else{
          System.out.println("\n The Credit Card Number is Invalid. ");
        }
    }
    public static boolean isValid(long[] array) {
        int total = sumOfDoubleEvenPlace(array) + sumOfOddPlace(array);        
        if ((total % 10 == 0)) {
         for (int i=0; i< array.length; i++){
            System.out.println(array[i]);}
            return true;
        } else {
          for (int i=0; i< array.length; i++){
            System.out.println(array[i]);}
            return false;
        }
    }
    public static int getDigit(int number) {
        if (number <= 9) {
            return number;
        } else {
            int firstDigit = number % 10;
            int secondDigit = (int) (number / 10);
            return firstDigit + secondDigit;
        }
    }
    public static int sumOfOddPlace(long[] array) {
        int result = 0;
        for (int i=0; i< array.length; i++)
        {
        while (array[i] > 0) {
            result += (int) (array[i] % 10);
            array[i] = array[i] / 100;
         }}
         System.out.println("\n The sum of odd place is " + result);
        return result;
    }
    public static int sumOfDoubleEvenPlace(long[] array) {
        int result = 0;
        long temp = 0;
        for (int i=0; i< array.length; i++){
        while (array[i] > 0) {
             temp = array[i] % 100;
             result += getDigit((int) (temp / 10) * 2);
            array[i] = array[i] / 100;
           }
        }
        System.out.println("\n The sum of double even place is " + result);
        return result;
    }
     }