public class ReverseUserIputArray {
public static void main(String[]args){
int anArray;
Scanner inArray = new Scanner(System.in);
System.out.println("enter how many elements to save in array");
int elements = inArray.nextInt();
System.out.println("you want to have " + elements + " element");
int[] array = new int[elements];
if(elements==0 || array.length <=1){
System.out.println("compile again");
}
for(int i=0; i<elements;i++){
System.out.println("index " + i);
array[i] = inArray.nextInt();
}
System.out.println("original array is " + Arrays.toString(array));
for (int i = 0; i < array.length; i++) {
anArray = array[i];
array[i] = array[array.length - 1 - i];
array[array.length - 1 - i] = anArray;
System.out.println("reversed number of array is " + Arrays.toString(array));
}
}
}