http://www.oschina.net/code/snippet_120166_6102
public class Quick
{
public static void main(String []args)
{
int arr[]={8,2,3,4,5,9};
Quick q=new Quick();
q.quickly(arr,0,arr.length-1);
for (int i=0;i<arr.length;i++)
{
System.out.println("第"+i+"个数是: "+arr[i]);
}
}
public int quick(int a[],int i,int j)
{
int r=i;
int w=j;
int x=a[i];
while (i<j)
{
while (i<j & x<=a[j])
{
j--;
}
if (i<j)
{
a[i++]=a[j];
}
while (i<j & x>a[i])
{
i++;
}
if (i<j)
{
a[j--]=a[i];
}
}
a[i]=x;
System.out.println("下标为:"+i);
return i;
}
public void quickly(int a[],int low,int hight)
{
if(low<hight)
{
int result=quick(a,low,hight);
quickly(a,low,result-1);
quickly(a,result+1,hight);
}
}
}