есть метод
private static boolean itsArmstrong(long n){
        long powSum = 0;
        long x = n;
        int quantityOfDigits = ((int)Math.log10(x)) + 1;
        System.out.println("quantity is " + quantityOfDigits);
        do{
            int mod = (int) x % 10;
            System.out.println("digit is "+ mod);
            if(mod < 0){
                System.out.println("number is "+ n);
                System.out.println("mod is "+ mod);
                System.out.println("----------------------------------");
            }
            powSum += pows[mod][quantityOfDigits];
            x /= 10;
        }while(x != 0);
        return powSum == n;
    }
на ввод попадает число 2324522937 вывод такой: quantity is 10 digit is -9 number is 2324522937 mod is -9 ---------------------------------- почему он семерку видит как -9? Спасибо.