title: Quick Sort Java
body: <p>Hi I'm currently working on getting my Quick Sort program working but cannot figure out where I'm going wrong, i have spent hours trying to find out why it's not working but no luck,when I run my code nothing happens. I have four other sorting algorithms working in a similar fashion which is what's confusing me the most.
  Below is my code for the Quick Sort program</p>
  
  <pre><code>import java.io.IOException;
  
  public class QuickSort  {
  
  
  
  public static int[] compute(int[] array, int lower, int higher )throws IOException{
  
      if(lower&lt;higher){
          int pivot=split(array,lower,higher);
          if(pivot&gt;1)
              compute(array, lower, pivot-1);
  
          if(pivot+1&lt;higher)
              compute(array, pivot+1, higher);
  
  
      }
  
      return array;
  
  }
  
  
  public static int split(int[] array, int lower, int higher){
  
      while(true){
          int pivot=array[lower];
  
          while(array[lower]&lt;pivot)
              lower++;
  
          while(array[higher]&gt;pivot)
              higher--;
  
  
          if(lower&lt;higher){
  
              int temp=array[higher];
              array[higher]=array[lower];
              array[lower]=temp;
          }
          else{
          return higher;
      }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Here is my Test class that's running the code:</p>
  
  <pre><code>import java.io.IOException;
  import java.util.Scanner;
  
  
  public class Test extends ReadIn{ 
  
  static BubbleSort bubble=new BubbleSort();
  
  
    public static void main(String[] args) throws IOException{
    System.out.println("Enter 1 for BubbleSort\nEnter 2 for Insertion Sort\nEnter 3      for Selection Sort\nEnter 4 for Merge Sort\nEnter 5 for QuickSort\nPlease input sorting algorithm to use for sorting:");
    Scanner input=new Scanner(System.in);
    int number=input.nextInt();
    final long startTime = System.currentTimeMillis();
    int[] Array=read();
  
    if(number==1){
        Array=BubbleSort.compute(Array);
          for(int i=0;i&lt;BubbleSort.compute(Array).length;i++){
        System.out.println(Array[i]);
  
      }
  
    }
    if(number==2){
        Array=InsertionSort.compute(Array);
          for(int i=0;i&lt;InsertionSort.compute(Array).length;i++){
        System.out.println(Array[i]);
  
      }
  
    }
    if(number==3){
        Array=SelectionSort.compute(Array);
          for(int i=0;i&lt;SelectionSort.compute(Array).length;i++){
        System.out.println(Array[i]);
  
      }
  
    }
    if(number==4){
        Array=MergeSort.compute(Array);
          for(int i=0;i&lt;MergeSort.compute(Array).length;i++){
        System.out.println(Array[i]);
  
      }
  
    }
    if(number==5){
    Array=QuickSort.compute(Array,0,Array.length-1);
          for(int i=0;i&lt;QuickSort.compute(Array,0,Array.length-1).length;i++){
        System.out.print(Array[i]);
  
      }
  
    }
  
  
      final long endTime = System.currentTimeMillis();
      System.out.println("Total execution time: " + (endTime - startTime) );
  }
  
  
  
  
  
  }
  </code></pre>
  
  <p>When I press 5 nothing happens, the rest work perfectly.
  I cant figure out whatsoever what the problem is so any help or input would be appreciated.</p>