package demo1;
import java.util.Arrays;
public class bubbling {
public static void main(String[] args) {
int[] arr ={8,89,100,45,54,82};
//外层循环,判断我们要走多少次
for (int j = 0; j < arr.length; j++) {
for (int i = 0; i < arr.length -1 - j; i++) {
//内层循环
if (arr[i+1]>arr[i + 1]) {
int temp = arr[i];
arr[i]= arr[i+1];
arr[i+1]=temp;
}
}
System.out.println( Arrays.toString(arr));
}
}
}