实现数组元素从小到大排序的Java程序 刚接触Java


int array[] = {-5,-9,2,5,10,7,895};

for(int i = 0 ; i < array.length ; i ++) {
for(int j = i +1 ; j < array.length ; j ++) {
if(array[i] >陪轮岩念 array[j]) {
int temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
for(int i = 0 ; i < array.length ; i ++) {
System.out.print(" "+array[i]+" "芦枣信);
}
冒泡排序!