Public static void main (String [] args) {
Int a []=new int [10].//define int array
//generate 10 random Numbers
System. The out. Print (" to generate 10 random integer is: ");
for(int i=0; I
A [I]=(int) (Math. The random () * 100);
System. The out. Print (a [I] + "");
//array element reverse output
System.out.println();
System. Out. Print (" reverse order in producing order 10 random integer is: ");
For (int I=a. ength - 1; I>=0; I -) {//to copy an array, used to store 100 within 10 random integer
System. The out. Print (a [I] + "");
}
}
}
CodePudding user response:
Don't you think that write a more concisePublic static void main (String [] args) {
List
for (int i=0; I & lt; 10; I++) {
ArrList. Add ((int) (Math. The random () * 100));
}
//positive order
System. The out. Println (arrList. ToString ());
//reverse order
The Collections. Reverse (arrList);
System. The out. Println (arrList. ToString ());
}