日期:2014-05-20 浏览次数:20705 次
public class Test19 { public static void main(String[] args) { int[] array = {0,15,-8,5,-6,16,6,-2,5}; int temp = 0; for(int i=0; i<array.length - 1; i++){ for(int j=0; j<array.length - i -1; j++){ if(array[j] < array[j+1]){ temp = array[j]; array[j] = array[j+1]; array[j + 1] = temp; } } } for(int n: array){ System.out.println(n); } } }