title: How do I reverse the integers in one array using another array?
body: <p>I have gotten 10 values from the user, and I am suppose to put that into an array and call it into a method, and then call another method which contains an array that reverses the integers of the first array without using global variables.  For example, the user gives me values 1,2,3, etc.. and I store that in the first array, then in the second array I output 3,2,1.</p>
  
  <p>I have part of the code that gets the integers from the user, but I don't know how to reverse the array without using global variables.  The code doesn't run when it gets to the second method at <code>values[i]</code>;</p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>public static void main(String[] args) {
  
      getInput();
      reverseInput();
      System.exit(0);
  }  
  
  public static void getInput() {
  
      Scanner keyboard = new Scanner(System.in);
  
      int[] values;
      values = new int[10];
  
      //Ask the user to enter 10 integers
      System.out.println("Please enter ten numbers.");
      for (int i = 0; i&lt;values.length; i++) {//for loop to display the values entered
          values[i] = keyboard.nextInt();
          System.out.println("Value" + (i +1) + " is " + values[i]);
      }
  }
  
  public static void reverseInput() { 
  
      System.out.println("Now we are going to reverse the numbers.");
      Scanner keyboard = new Scanner(System.in);
  
      int [] values;
      values = new int[10];
  
      for (int i = (values.length -1); i&gt;= 0; i--) {//for loop to display integers in reversed order
          values[i];
          System.out.println(values[i]);
      }
  }
  </code></pre>