public class test1{
public static void main(String[] args){
int[] nums = {34,4,56,17,90,65};
int jc = 0;
for(int i=0;i<nums.length-1;i++){
for(int j=0;j<nums.length-1-i;j++){
if(nums[j]>nums[j+1]){
jc = nums[j];
nums[j] = nums[j+1];
nums[j+1] = jc;
}
}
}
for(int n:nums){
System.out.println(n);
}
}
}
测试结果: