public class maopaopaixu { public static void main(String[] args) { int score[] = { 5, 6, 4, 8, 7, 9 }; for (int i = 0; i < score.length - 1; i++) { for (int j = 0; j < score.length - i - 1; j++) { if (score[j] < score[j + 1]) { int temp = score[j]; score[j] = score[j + 1]; score[j + 1] = temp; } } System.out.print("第" + (i + 1) + "次排序结果:"); for (int a = 0; a < score.length; a++) { System.out.print(score[a] + " "); } System.out.println(""); } System.out.print("最终排序结果:"); for (int a = 0; a < score.length; a++) { System.out.print(score[a] + " "); } } }