package sort;
public class QuickSort {
    public static void quickSort(int[] arr, int start, int end) {
        if (start >= end) {    // if only one element
            return;
        }
        int key = start;   // first element is pivot
        int i = start + 1;
        int j = end;
        int temp;
        while(i <= j) {   // repeat until cross
            while(arr[i] <= arr[key]) {  // move right until bigger than key
                i++;
            }
            while(arr[j] >= arr[key] && j > start) {  // move left until smaller than key
                j--;
            }
            if(i > j) {  // swap if its crossed
                temp = arr[j];
                arr[j] = arr[key];
                arr[key] = temp;
            } else {
                temp = arr[j];
                arr[j] = arr[i];
                arr[i] = temp;
            }
        }
        quickSort(arr, start, j - 1);
        quickSort(arr, j + 1, end);
    }
    public static void main(String[] args) {
        int number = 10;
        int[] arr = {1, 10, 5, 8, 7, 6, 4, 3, 2, 9};
        quickSort(arr, 0, number-1 );
    }
}
I tried to learn Quick Sort. This is my code. and keep getting this message
What went wrong:
Execution failed for task ':QuickSort.main()'.
Process 'command 'C:/jdk1.8/bin/java.exe'' finished with non-zero exit value 1
I don't understand why I keep getting fail. I watched youtube and followed every step.
