标签:style java ar for sp c ef r bs
private static void BubbleSort(int[] a,int n)
{
boolean flag = false;
int temp;
for (int i = 0; i < a.length-1; i++)
{
flag = false;
for (int j = a.length-1; j > i; j--)
{
if(a[j-1]>a[j])
{
/*temp = a[j-1]; a[j-1] = a[j]; a[j] = temp;*/
a[j] = a[j]+a[j-1]; a[j-1] = a[j]-a[j-1]; a[j] = a[j]-a[j-1];
flag = true;
}
}
if(flag == false)
return ;
}
}
标签:style java ar for sp c ef r bs
原文地址:http://www.cnblogs.com/oraclespace/p/3976050.html