定义一个数字数组,用冒泡排序降序输出
public class M{
int[] array = {2,3,6.5.89.4.1.6};
int b = array.length;
int temp = 0;
for(int i=0;i<b;i++){
for(int j=i+1;j<b;j++){
if(array[i]>array[j]){
temp = a[i];
a[j] = a[i];
a[j] = temp;
}
}
}
System.out.print("array元素的降序排序:");
for(int i=0;i<b;i++);
System.out.println(array[i]+"");
}