//冒泡排序
package com.ShiXun_JiChu;
import java.util.Arrays;
public class day20221119_05 {
public static void main(String[] args) {
int []arr={10,5,2,11};
System.out.println(Arrays.toString(arr));
for (int i = 0; i <arr.length-1 ; i++) {
for (int j = 0; j < arr.length - 1 - i; j++) {
int a = 0;
if (arr[j] > arr[j + 1]) {
a = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = a;
}
}
}
//这是排序后的数组顺序
System.out.println(Arrays.toString(arr));
}
}
/*
重点:
System.out.println(Arrays.toString());
Arrays.toString()输出数组里面元素
*/
标签:arr,Arrays,System,冒泡排序,int,toString,关于 From: https://www.cnblogs.com/CHX249/p/16905765.html