title: Reverse array index of ints
body: <p>I am attempting to reverse an Array of int values. It does not seem to be doing it correctly.
  You will note that I am printing in different ways, like <code>Array.toString()</code> and also using <code>println</code>.</p>
  
  <p>The original array prints:</p>
  
  <pre><code>1 4 9 16 9
  </code></pre>
  
  <p>I need it to print:</p>
  
  <pre><code>9 16 9 4 1
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>import java.util.Arrays;
  
  public class ReverseArray {
      public static void main(String[] args) {
          int[] data = { 1, 4, 9, 16, 9 };
          reverseArray(data);
          int[] dataR = reverseArray(data);
          System.out.println("Reveresed data " + Arrays.toString(dataR));
      }
  
      public static int[] reverseArray(int[] data) { // returns the reverse of the
                                                      // array data
          // int [] data = new int[5];
          int[] reversedData = new int[data.length];
  
          data[0] = 1;
          data[1] = 4;
          data[2] = 9;
          data[3] = 16;
          data[4] = 9;
  
          System.out.println(Arrays.toString(data));
          for (int i = 0; i &lt; data.length - 1; i++) {
              System.out.println("Original Array: " + data[i]);
          }
  
          int reveresedData[] = data;
  
          for (int i = 0; i &lt; reveresedData.length - 1; i++) {
              reversedData[(data.length - 1) - i] = data[i];
              System.out.println(reveresedData[i]);
          }
          return reveresedData;
      }
  
  }
  </code></pre>