冒泡排序
public class Demo {
public static void main(String[] args) {
//冒泡排序
int[] ints = {3,2,43,54,32,22,-2,34,66,35};
int temp;
for (int i = 0; i < ints.length - 1; i++) {//从第i个数开始
for (int j = 0; j < ints.length - 1; j++) {//比较j次 如果比后面数大就交换
if(ints[j] > ints[j + 1]){
temp = ints[j];
ints[j] = ints[j + 1];
ints[j + 1] = temp;
}
}
}
for (int i = 0; i < ints.length; i++) {
System.out.println(ints[i]);
}
}
}