private int arraytest[];
public static void main(String ags[]){
ConvertDemo c = new ConvertDemo();
c.arraytest = new int[5];
//对数组赋值
c.arraytest[0] = 5;
c.arraytest[1] = 4;
c.arraytest[2] = 3;
c.arraytest[3] = 2;
c.arraytest[4] = 1;
ArrayConvert a = new ArrayConvert(c.arraytest);
a.sort();
}
}
class ArrayConvert {
private int array[];
ArrayConvert (int array[]){
this.array = array;
}
void sort(){
int i,j;
int ary[] = new int[array.length];
//排序
for(i=0,j=array.length-1;i<array.length;i++,j--){
ary[j] = array[i];
}
//打印 输出已排序好的内容
for(i=0;i<array.length;i++){
System.out.println(ary[i]);
}
}
}