Perfect number 1-1000 program help

I am doing an exercise in my book that asks to make a program that finds the perfect numbers from 1-1000. The way I wrote the program makes sense to me but I am not getting the results I am supposed to be getting. Here is what I have (a perfect number is the sum of numbers that divide evenly into it equaling the number example 6 is 1, 2, 3 which add up to 6):

Code:

`//finds the perfect numbers between 1-1000`

public class Perfect

{

public static void main(String[] args)

{

int number, total = 0;

final int LIMIT = 1000;

for(number = 1; number <= LIMIT; number++)

{

if(total == (number - 1))// optimized so it isn't checked in inner loop, have to subtract 1 to account for increment

System.out.println(number + " is a perfect number");

total = 0;//reset total

for(int divider = 1; divider < number; divider++)

{

if((number % divider) == 0)

total += divider;

}

}

}

}

Can anyone tell me what I am doing wrong?