code: public static void swap(short[] shortArray1, short[] shortArray2) {     
          int minLength = Math.min(shortArray1.length, shortArray2.length);
          
          for(int i = 0; i < minLength; i++) {
              XORSwap.swap(shortArray1, shortArray2, i);
          }
      }
docs: Helper method that swaps all the elements of the array. This method runs in
  O(<code>Math.min(array1.length, array2.length</code>) time.
  
  @param shortArray1 one array that will have its values swapped.
  @param shortArray2 other array that will have its values swapped.