Java Array Max Value maxIndices(double[] aArray, Integer[] indices)

Here you can find the source of maxIndices(double[] aArray, Integer[] indices)

Description

max Indices

License

Open Source License

Declaration

public static Integer[] maxIndices(double[] aArray, Integer[] indices) 

Method Source Code

//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;
    }
}

Related

  1. maxIndex(int[] list)
  2. maxIndex(int[] shape)
  3. maxIndex(int[] values, int begin, int end)
  4. maxIndex(Number[] array)
  5. maxIndex(T[] array)
  6. maxIndices(int values[])
  7. maxInt(int... values)
  8. maxInVector(double[] _vector)
  9. maxJoinArray(float[] array1, float[] array2)