Perfect Number Algorithm

It is not known whether there are any odd perfect numbers, nor whether infinitely many perfect numbers exist. In number theory, a perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. In 1588, the Italian mathematician Pietro Cataldi identify the sixth (8,589,869,056) and the seventh (137,438,691,328) perfect numbers, and also proved that every perfect number obtained from Euclid's rule ends with a 6 or an 8.St Augustine determines perfect numbers in city of deity (Part XI, Chapter 30) in the early 5th century ad, repeating the claim that deity created the universe in 6 days because 6 is the smallest perfect number. Nicomachus states without proof that every perfect number is (putting it in our terms) of the form
package Maths;

/**
 * In number theory, a perfect number is a positive integer that is equal to the sum of
 * its positive divisors, excluding the number itself. For instance, 6 has divisors 1, 2 and 3
 * (excluding itself), and 1 + 2 + 3 = 6, so 6 is a perfect number.
 * <p>
 * link:https://en.wikipedia.org/wiki/Perfect_number
 * </p>
 */
public class PerfectNumber {
    public static void main(String[] args) {
        assert isPerfectNumber(6); /* 1 + 2 + 3 == 6 */
        assert !isPerfectNumber(8); /* 1 + 2 + 4 != 8 */
        assert isPerfectNumber(28); /* 1 + 2 + 4 + 7 + 14 == 28 */
    }

    /**
     * Check if {@code number} is perfect number or not
     *
     * @param number the number
     * @return {@code true} if {@code number} is perfect number, otherwise false
     */
    public static boolean isPerfectNumber(int number) {
        int sum = 0;  /* sum of its positive divisors */
        for (int i = 1; i < number; ++i) {
            if (number % i == 0) {
                sum += i;
            }
        }
        return sum == number;
    }
}

LANGUAGE:

DARK MODE: