标签:
public int[] bubbleAlgorithmSort(int[] intArray){
int arrayLength = intArray.length;
for( int i = 0; i < arrayLength-1 ;i++ ) {
for( int j = 0; j < arrayLength - i - 1 ; j++ ) {
if(intArray[j] > intArray[j+1] ) { //升序
int compareInt = intArray[j];
intArray[j] = intArray[j+1];
intArray[j+1] = compareInt;
}
}
}
return intArray;
}
标签:
原文地址:http://www.cnblogs.com/jimmy-muyuan/p/5773835.html