public static void reorder ( int [ ] array , int [ ] order ) { int [ ] original = copyOf ( array ) ; for ( int i = 0 ; i < array . length ; i ++ ) { array [ i ] = original [ order [ i ] ] ; } }
Reorder array in place .