标签:ar java for sp bs as nbsp class print
package my;
public class MyJava {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] num = {10,5,13,22,87,44};
int temp;
//控制比较的轮数
for (int i = 0; i < num.length-1; i++) {
//每轮比较的次数
for (int j = 0; j < num.length-1-i; j++) {
//两个数比较大小,交换位置
if (num[j]<num[j+1]) {
temp = num[j];
num[j]= num[j+1];
num[j+1] = temp;
}
}
}
for (int i = 0; i < num.length; i++) {
System.out.println(num[i]);
}
}
}
标签:ar java for sp bs as nbsp class print
原文地址:http://www.cnblogs.com/xunbu7/p/4053294.html