public static < E > void swap ( E [ ] array1 , int array1Index , E [ ] array2 , int array2Index ) { if ( array1 [ array1Index ] != array2 [ array2Index ] ) { E hold = array1 [ array1Index ] ; array1 [ array1Index ] = array2 [ array2Index ] ; array2 [ array2Index ] = hold ; } }
Swap the elements of two arrays at the specified positions .