Java Array Min Value minIndex(double[] arr)

Here you can find the source of minIndex(double[] arr)

Description

return index of minimal number

License

Apache License

Declaration

public static int minIndex(double[] arr) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**/*from   w  ww.j  a  va  2  s.c  om*/
     * return index of minimal number
     */
    public static int minIndex(double[] arr) {

        if (arr.length <= 0)
            return -1;

        double min = Double.MAX_VALUE;
        int index = 0;

        for (int i = 0; i < arr.length; i++) {
            if (arr[i] < min) {
                min = arr[i];
                index = i;
            }
        }

        return index;
    }
}

Related

  1. minimumWordLength(String[] words)
  2. minIn(double[] array)
  3. minIndex(double values[])
  4. minIndex(double... data)
  5. minIndex(double[] a)
  6. minIndex(double[] list)
  7. minIndex(double[] v)
  8. minIndex(double[] value)
  9. minIndex(double[] x, int length)