title: Filling two new arrays from existing array
body: <p>I already have one Array with random numbers between 0-999.
  I also have created two new arrays, one with correct the size to hold all numbers 0-499, and one with the correct size for numbers 500-999. </p>
  
  <p>Problem is to then loop through the Array holding all numbers and copying the right numbers 0-499 and 500-999 to the new Arrays. </p>
  
  <p>Anyone know the correct way to do this? Have spent many days now trying to figure this out. </p>
  
  <p>What i got so far: </p>
  
  <pre><code>   public static void main(String[] args) {
  
      Scanner scannerObject = new Scanner(System.in);
      Random generator = new Random();
  
      System.out.print("How many numbers between 0 - 999?" );
      int number= scannerObject.nextInt(); 
  
      int [] total= new int[number]; 
  
      for(int index = 0; index &lt; total.length; index++ ) 
      {   
          total[index] = generator.nextInt(1000); 
      }
  
      System.out.println("Here are the random numbers:");
  
      for(int index = 0; index &lt; total.length; index++ )
      {   
  
          System.out.print(total[index]+ " ");    
      }
  
      int lowNumber=0;
      int largeNumber = 0;
      for(int index = 0; index &lt; total.length; index++ )  
      {   
          if (total[index] &lt; 500)
          {       
              lowNumber++;    
          }
  
          if (total[index] &gt;= 500)
          {
              largeNumber++;
          }
      }
      System.out.println();
      System.out.println(lowNumber);
      System.out.println(largeNumber);
  
      int [] totalLownumber = new int [lowNumber];
      int [] totalLargeNumber = new int [largeNumber];
  
      for(int index = 0; index &lt; total.length; index++ )  
      {   // TODO
      }
  }
  </code></pre>