//从大到小排序
public class Demo081Array {
public static void main(String[] args) {
// TODO 自动生成的方法存根
int[] a = {1, 44, 43, 90, 100};
//a.length-1是为了避免索引溢出
//外层循环是循环次数
for (int i = 0; i < a.length-1; i++)
{
//里层是比较大小
for (int j = 0; j < a.length-1-i; j++)
{
if (a[j + 1] > a[j])
{
int temp = a[j];
a[j] = a[j + 1];
a[j + 1] = temp;
}
}
}
//重新排序
for (int i = 0; i < a.length; i++)
{
System.out.print(a[i] + " "); //100 90 44 43 1
}
}
}