title: Stack Overflow in Java QuickSort on Array
body: <p>Does anyone have any idea why I would be getting a stack overflow on my quicksort in the following code?:</p>
  
  <pre><code>   private int[] concat( int[] less, int inxl, int pivot, int inxm, int[] more )
     {
  
        int[] concated = new int[ less.length ];
  
        for( int inx = 0; inx &lt; inxl; inx++ )
        {
  
           concated[ inx ] = less[ inx ];
  
        }
  
        concated[ inxl ] = pivot;
        inxl++;
  
        for( int inx = 0; inx &lt; inxm; inx++ )
        {
  
           concated[ inxl ] = more[ inx ];
           inxl++;
  
        }      
  
        return concated;
  
     }
  
     private int[] quickSort( int[] array )
     {
  
        if( array.length &lt;= 1 )
           return array;
  
        int[] less = new int[ array.length ];
        int[] more = new int[ array.length ];
        int inxl = 0, inxm = 0;
  
        for( int inx = 1; inx &lt; array.length; inx++ )
        {
  
           if( array[ inx ] &lt; array[ 0 ] )
           {
  
              less[ inxl ] = array[ inx ];
              inxl++;
  
           }
           else
           {
  
              more[ inxm ] = array[ inx ];
              inxm++;
  
           }
  
        }
  
        return concat( quickSort( less ), inxl, array[ 0 ], inxm, quickSort( more ) );
  
     }
  </code></pre>
  
  <p>Any help would be greatly appreciated. I am revising for an interview and been a little rusty so time is of grave importance. Thanks upfront! :)</p>
  
  <p>Sincerely,
  Piotr.</p>