Here you can find the source of permute(int[] in, int[] idx)
public static final int[] permute(int[] in, int[] idx)
//package com.java2s; //License from project: Apache License public class Main { public static final int[] permute(int[] in, int[] idx) { int[] out = new int[in.length]; for (int i = 0; i < in.length; i++) out[i] = in[idx[i]];//from w w w . ja v a 2s. c o m return out; } public static final float[] permute(float[] in, int[] idx) { float[] out = new float[in.length]; for (int i = 0; i < in.length; i++) out[i] = in[idx[i]]; return out; } public static final double[] permute(double[] in, int[] idx) { double[] out = new double[in.length]; for (int i = 0; i < in.length; i++) out[i] = in[idx[i]]; return out; } }