Here you can find the source of reversePermutation(T[] arr, List
public static <T> T[] reversePermutation(T[] arr, List<Integer> p)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static <T> T[] reversePermutation(T[] arr, List<Integer> p) { T[] arr_new = arr.clone(); for (int i = 0; i < arr.length; i++) { arr_new[i] = arr[p.get(i)]; }/* w ww . jav a 2 s . c om*/ return arr_new; } }