title: swap first and last value in an array (JAVA)
body: <p>I believe the code works but the tester code isn't and I'm not sure why. I'm trying to swap the first and last value in an array.</p>
  
  <pre><code>public class ArrayMethods {
  
   private int[] values;
   public ArrayMethods(int[] initialValues) {
      values = initialValues;
    }
   public void swapFirstAndLast() {
      int lastvalplace = values.length;
      int firstval = values[0];
      values[0] = values[lastvalplace];
      values[lastvalplace] = firstval;
   }
  
   public static void main(String[] args) {
       ArrayMethods initialValues = new ArrayMethods(int[] 50, 32, 4, 9, 2);
       swapFirstAndLast = new swapFirstAndLast(values);
   }
  
  }
  </code></pre>