A Java method cannot update primitive type parameters. For example, the following method does not work as intended:

public class SwapTester
{
   public static void falseSwap(int a, int b) // doesn't work
   {
      int temp = a;
      a = b;
      b = temp;
   }

   public static void main(String[] args)
   {
      int x = 3;
      int y = 4;
      falseSwap(x, y);
      System.out.println(x + " " + y);
      System.out.println("Expected: 4 3"); // test fails
   }
}

Your task is to implement a method trueSwap that swaps two values that were placed into an array.

Complete the following file:

SwapTester.java

public class SwapTester { /** Swaps two values @param array an array of length 2 containing the values to be swapped */ public static void trueSwap(int[] array) { // TODO: Complete . . . } public static void main(String[] args) { int[] xy = new int[2]; xy[0] = 3; xy[1] = 4; // TODO: call trueSwap and print swapped values . . . System.out.println("Expected: 4 3"); } }