I've been working thru a programming book and I am having issues. I am supposed to check if an inputed integer is perfect or not, then display the factors following the number.

I have 4 methods total including the main method. The problem is I am supposed to use an array to store the factors of the number as I go along and I'm stuck. I can't fill in the last method (the one that is supposed to print out the number and its factors to the screen) without figuring out how I am supposed to store the factors into an array. It would be probably best to create the array in the main method, but I'm pretty new to programming and don't fully understand how to use them.

If you could point me in the right direction, that would be great.

Thanks

import java.util.Scanner; public class check_perfect { public static void main ( String args[] ) { Scanner input = new Scanner ( System.in ); int numbers; int pp = 0; // possible perfect int counter = 0; do { System.out.print ( "How many numbers would you like to test?" ); numbers = input.nextInt(); } while ( validateNum ( numbers ) = false ); do { System.out.print ( "Please enter a possible perfect number: " ); pp = input.nextInt(); testPerfect ( pp ); printFactors ( pp ); counter ++; } while ( counter < numbers ); } public boolean validateNum ( int numbers ) { if ( numbers < 1 ) { return false; } else { return true; } } public boolean testPerfect( int pp ) { int sum = 0; int x = 0; for ( int i = 1; i < pp; i++ ) { if ( ( pp % i ) == 0 ) { x = i; sum += x; } if ( x == pp ) { return true; } else { return false; } } } public static printFactors() { } }