The codes might be not optimized, and the first elements of all arrays are chosen as the pivots, which will cause a tremendous slow-down when the array is sorted already.
public static void swap(int[] ar, int a, int b){
int tmp = ar[a];
ar[a] = ar[b];
ar[b] = tmp;
}
public static int partition(int[] a, int left, int right) {
int pivot=a[left];
int m=left;
for(int i=left+1;i<=right;i++){
if (a[i]=right)
return;
int pivotIndex = partition(a, left, right);
quicksort(a, left, pivotIndex-1);
quicksort(a, pivotIndex+1, right);
}