Perfect number in Java using while loop

This is an exciting problem where we want to determine if a number is a perfect number or not

Determine Perfect number in Java using while loop

So we try to determine if a given number is perfect or not, that is if the sum of proper divisor is equal to itself.
/**
 * An example program that Determine Perfect number in Java using while loop.
 */
public class ExampleProgram {
    public static void main(String[] args) {
        System.out.println(6 + " is perfect? : " + isPerfect(6));
        System.out.println(12 + " is perfect? : " + isPerfect(12));
        System.out.println(28 + " is perfect? : " + isPerfect(28));
        System.out.println(32 + " is perfect? : " + isPerfect(32));
    }
    public static boolean isPerfect(int n) {
        int i = 1;
        int sum = 0;
        while (i < n) {
            if (n % i == 0) {
                sum = sum + i;
            }
            i++;
        }
        return sum == n;
    }
}

And below are the sample output when we run this:

6 is perfect? : true
12 is perfect? : false
28 is perfect? : true
32 is perfect? : false