public static void swap(float[] floatArray1, float[] floatArray2) {     
        int minLength = Math.min(floatArray1.length, floatArray2.length);
        
        for(int i = 0; i < minLength; i++) {
            TrivialSwap.swap(floatArray1, floatArray2, i);
        }
    }
public static void swap ( float [ ] floatArray1 , float [ ] floatArray2 ) { int minLength = Math . min ( floatArray1 . length , floatArray2 . length ) ; for ( int i = 0 ; i < minLength ; i ++ ) { TrivialSwap . swap ( floatArray1 , floatArray2 , i ) ; } }
Helper method that swaps all the elements of the arrays. This method runs in
O(<code>Math.min(array1.length, array2.length</code>) time.

@param floatArray1 one array that will have its values swapped.
@param floatArray2 the other array that will have its values swapped.