title: Random Number Sort Arrays
body: <p>For my java class, I have this problem: 
  Write a program that generates 100 random integers in the range 0 to 25, and stores them in an array. Then, the program should call a class method that sorts the odd numbers into an array and returns the array. The program should then call another method that sorts the even numbers into a separate array and returns the array. Both arrays should then be displayed.</p>
  
  <p>This is my code:</p>
  
  <pre><code>    public class Assignment8
       {
          public static void main(String [] args)
      {
      int [] randomNums = new int [100];
      for (int i = 0; i &lt; randomNums.length; i++) { 
          randomNums[i] = (int) (Math.random() * 26); 
          int[] oddNums = sortOdd(randomNums);
          System.out.println("The odd numbers are "); 
          for (int n = 0; n&lt;=oddNums.length; n++) { 
          System.out.print(n); 
          } 
          int[] evenNums = sortEven(randomNums);
          System.out.println("The even numbers are ");
          for (int o = 0; o&lt;=evenNums.length; o++) { 
          System.out.print(o); 
          } 
      }
      }
  
       public static int[] sortOdd(int[] randomNums)
        {
      int numOdds = 0;
      for (int x : randomNums){
          if(x % 2 == 1){
          ++numOdds;
          }
      }
      int[] oddNums = new int[numOdds]; 
      int z = 0;
      for (int n : randomNums){
          if(n % 2 == 1){
              oddNums[z] = n;
              z++;
          }
      }
      return oddNums;
  
  
        } 
        public static int[] sortEven(int[] randomNums)
        {
      int numEvens = 0;
      for (int x : randomNums){
          if(x % 2 == 0){
          ++numEvens;
          }
      }
      int[] evenNums = new int[numEvens];
      int z = 0;
      for (int n : randomNums){
          if(n % 2 == 0){
              evenNums[z] = n;
              z++;
          }
      }
      return evenNums;
  
      }
  
  
  
      }
  </code></pre>
  
  <p>It is just printing out a bunch of numbers and the words "The even numbers are" and "The odd numbers are". What should I fix in my code to make it fulfill my assignment?</p>