//降序 int[] ns2 = { 28, 12, 89, 73, 65,36, 18, 96, 50, 8}; for(int i = ns2.length; i>0;i--){ for(int j = ns2.length -1; j > ns2.length-i ;j--){ if(ns2[j] > ns2[j-1]){ int tmp = ns2[j]; ns2[j] = ns2[j-1]; ns2[j-1] = tmp; } } } System.out.println(Arrays.toString(ns2));
Sign in to make a reply
阿风-_-