Here you can find the source of sortAccording(float[] ary, Integer[] sortOrder)
public static float[] sortAccording(float[] ary, Integer[] sortOrder)
//package com.java2s; //License from project: Apache License public class Main { /** Create a new sorted array according to given sort order */ public static float[] sortAccording(float[] ary, Integer[] sortOrder) { float[] res = new float[ary.length]; for (int i = 0; i < ary.length; i++) res[i] = ary[sortOrder[i]];/*from www . ja v a 2 s . c o m*/ return res; } public static String[] sortAccording(String[] ary, Integer[] sortOrder) { String[] res = new String[ary.length]; for (int i = 0; i < ary.length; i++) res[i] = ary[sortOrder[i]]; return res; } public static int[] sortAccording(int[] ary, Integer[] sortOrder) { int[] res = new int[ary.length]; for (int i = 0; i < ary.length; i++) res[i] = ary[sortOrder[i]]; return res; } }