public class quickSort { public static void main(String[] args) { // TODO Auto-generated method stub int [] aa ={23,454,64,65,665,453,234,6,65,75,767,76734,43,2343,656,5754,7547}; quickSort qs=new quickSort(); qs.quick(aa); for(int i=0;i<aa.length;i++){ System.out.println(aa[i]); } } public void quick(int [] sorted){ if(sorted.length>0){ _quicksort(sorted,0,sorted.length-1); } } public void _quicksort(int [] sorted,int low,int high){ if(low<high){ int middle=getMiddle(sorted,low,high); _quicksort(sorted,low,middle-1); _quicksort(sorted,middle+1,high); } } public int getMiddle(int [] sorted,int low,int high){ int tmp=sorted[low]; while(low<high){ if(low<high && sorted[high]>=tmp){ high--; } sorted[low]=sorted[high]; if(low<high && sorted[low]<=tmp){ low++; } sorted[high]=sorted[low]; } sorted[low]=tmp; return low; } }