/*根据以下网站上的计划:http://www.java2novice.com/java-sorting-algorithms/quick-sort/*/包com.java2novice.stringing;公共类MyQuickSort{私有int数组[];//要排序的数组私有int长度;//数组的长度公共void排序(int[]inputArr){if(inputArr==null ||inputArr.length==0)回报;this.array=输入Arr;length=inputArr.length;/*不要硬编码长度长度=27;调用排序例程*/quickSort(0,长度-1);}private void quickSort(int lowerIndex,int higher Index){int i=lowerIndex;int j=较高指数;//计算枢轴数(数组中间的数字)int pivot=数组[lowerIndex+(higherIndex-lowerIndex)/2];//分成两个数组而(i<=j){/***在每次迭代中,我们将从左侧识别一个数字*它大于枢轴值,并且我们将确定*右侧的数字,小于枢轴值。*搜索完成后,我们交换两个数字。*/while(数组[i]<枢轴){i++;}while(array[j]>枢轴){j——;}如果(i<=j){交换号码(i,j);//将索引移动到两侧的下一个位置i++;j——;}}//递归调用quickSort()方法if(低指数<j)快速排序(lowerIndex,j);if(i<higherIndex)快速排序(i,较高索引);}私有void exchangeNumbers(int i,int j){int temp=数组[i];array[i]=array[j];数组[j]=温度;}公共静态void main(字符串a[]){MyQuickSort排序器=新的MyQuickSort=();int[]输入={24,2,45,20,56,75,2,56,99,53,12};sorter.sort(输入);for(int i:输入){System.out.print(i);System.out.print(“”);}}}