title: Program isn't calculating factors correctly and inputting into array
body: <p>I'm having issues with the <code>testPerfect</code> method. I need it to calculate the factors and put them into the array, then return a boolean value of <code>true</code> or <code>false</code> if the number is perfect or not. As of now the array is just getting 1,2,3...5,6,7...to whatever number was input to check.  Any suggestions? </p>
  
  <pre><code>import java.util.Arrays;
  import java.util.Scanner;
  
  public class moo_Perfect
  {
  public static void main ( String args [] )
  {
      int gN;
      int gP = getPerfect();
      int [] array = new int[100];
      boolean tP = testPerfect(gP, array);
      //int printFactors;
      System.out.println(Arrays.toString(array));
  }
  
  
  public static int getNum() //Get amount of numbers to check
  {
  Scanner input = new Scanner ( System.in );
  System.out.print( "How many numbers would you like to test? " );
  int count = input.nextInt();
  int perfect = 1;
  boolean vN = validateNum(count, perfect);
  while(!vN)
  {
      System.out.print (" How many numbers would you like to test? ");
      count = input.nextInt();
      vN = validateNum(count, perfect);
  }
  return count;
  }   
  
  public static boolean validateNum( int count, int perfect  ) //Check if number is valid
  {
  if (( count &lt;= 0) || ( perfect &lt;= 0))
  
  { 
      System.out.print( "Non-positive numbers are not allowed.\n");
  }
  
  
  
  else 
  {
      return true;
  }
  return false;
  
  
  }
  public static int getPerfect() //Gets the numbers to test
  {
  Scanner input = new Scanner ( System.in );
  int perfect = -1;
  int count = getNum();
  System.out.print("Please enter a perfect number: " );
  perfect = input.nextInt();  
  boolean vN = validateNum(perfect, count);
  while (!vN) 
  {
      System.out.print("Please enter a perfect number: ");
      perfect = input.nextInt();
      vN=validateNum(perfect, count);
  }
  return perfect;
  }
  
  
  public static boolean testPerfect( int perfect, int[] array )
  
  {
  //testPerfect(perfect, array);
  int limit = perfect;
  int index = 0;
  for ( int i = 1; i &lt;=limit; i++)
  {
      array[index++] = i;
      perfect /= i;
  }
  array[index] = perfect;
  int sum = 0;
  for ( int i =0; i &lt; array.length; i++)
  {
      sum = sum + array[i];
  }
  
  if ( sum == perfect)
  {
      int[] w = array;
  
      return true;        
  }
  
  else
  {
      return false;
  }
  
  
  }
  </code></pre>