冒泡排序(大熊版)

int[] arr = new int[] { 1, 24, 3, 4, 33, 14, 53, 82, 13 };
for(int i = arr.length - 1; i > 0; i--){
  for(int j = 0; j < i; j++){
    if(arr[j] > arr[j + 1]){
      int temp = arr[j];
      arr[j] = arr[j + 1];
      arr[j + 1] = temp;
    }
  }
}
for(int a : arr){
  System.out.print(a + " ");
}

原文地址:https://www.cnblogs.com/blogofcookie/p/4905486.html