Perfect numbers

The problem

A positive integer is called a perfect number if it is equal to the sum of all of its positive divisors, excluding itself. For example, 6 is the first perfect number because 6 = 3 + 2 + 1. The next is 28 = 14 + 7 + 4 + 2 + 1. There are four perfect numbers less than 10,000. Write a program to find all these four numbers.

Breaking it down

public static void main(String[] strings) {

    List<String> perfectNumbers = new ArrayList<>();

    for (int number = 1; number <= 10000; number++) {
        int total = 0;
        int divisor = number - 1;

        while (divisor > 0) {

            if (number % divisor == 0) {
                total += divisor;
            }
            divisor--;
        }

        if (number == total) {
            perfectNumbers.add(String.valueOf(number));
        }
    }

    System.out.println("Perfect numbers less than 10,000 are "
            + String.join(", ", perfectNumbers));
}

Output

Perfect numbers less than 10,000 are 6, 28, 496, 8128