Here you can find the source of maxIndices(double[] aArray, Integer[] indices)
public static Integer[] maxIndices(double[] aArray, Integer[] indices)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static double EPS = 1.0E-10; private static TreeMap<Double, Integer> value2indices; public static Integer[] maxIndices(double[] aArray, Integer[] indices) { if (value2indices == null) { value2indices = new TreeMap<Double, Integer>(); }/*from w ww . j a va 2 s . com*/ value2indices.clear(); for (int i = 0; i < aArray.length; ++i) { if (value2indices.get(aArray[i]) != null) { aArray[i] += EPS; } value2indices.put(-aArray[i], i); } value2indices.values().toArray(indices); return indices; } }