public class QuickSort{ public static void sort(int[] arr){ if(arr==null || arr.length==0){ return ; } quickSort(arr,0,arr.length-1); } public static void quickSort(int[] arr, int low, int high){ if(low<high){ int mid = getMid(arr,low,high); quickSort(arr,low,mid-1); quickSort(arr,mid+1,high); } } public static int getMid(int[] arr, int low, int high){ int temp = arr[low]; while(low<high){ if(low<high && arr[high]>=temp){ high--; } arr[low] = arr[high]; if(low<high && arr[low]<temp){ low++; } arr[high] = arr[low]; } arr[low] = temp; return low; } }