![java数组冒泡排序 java数组冒泡排序](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
public class PaiXu1 {
public static void main(String[] args) {
int[] s = {345,879,456,870,221,902,148,234,478};
System.out.println("排序之前:");
System.out.println(Arrays.toString(s));
System.out.println("排序之后:");
int temp = 0;
for (int i = 0;i < s.length-1;i++){
for (int j = 0;j < s.length-1-i;j++){
if (s[j]>s[j+1]){
temp = s[j];
s[j] = s[j+1];
s[j+1] = temp;
}
}
}
System.out.println(Arrays.toString(s));
}
}