package top.hyself; //冒泡排序法 public class Demo { public static void main(String[] args) { int[] arr = {1,5,6,7,9,8,3,0,2,4}; for(int i = 0;i < arr.length;i++) { for(int j = 0;j < arr.length - 1 -i;j++) { if(arr[j] < arr[j + 1]) { int temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } for(int i : arr) System.out.println(i); } }