title: Recursive/Sorting an Array a specific way
body: <p>To recursively sort an array, fi nd the largest element in the array and swap it with the last element. Then recursively sort the array from the start to the next-to-the-last element. Write and test a method that recursively sorts an array in this manner. Started it and I think my code complete trash. Recursion do not make much sense to me and just needing help with this problem. Ive found how to locate the highest int in the array just havihng trouble finding out the recursion to sort it now.</p>
  
  <pre><code>public class Sorting
  {
      public static void main(String[] args) 
      {
          int[] array={5,1,8,3,4,7};
          int length = array.length;
          int max = -99999;
          int[] revArray= sortArray(array,length-1,max,length);  
  
          for(int i:revArray)
              System.out.print(i+" ");
  
      }
  
      public static int[] sortArray(int[] a,int j,int max,int length)
      {        
  
          if( j &lt;= 0)   
          {    
              return a;  
  
          }
  
          if(max &lt; a[j])
          {
              max = a[j];            
              return sortArray(a, j-1, max,length); 
  
          }  
  
           return a;
      }
  }
  </code></pre>