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