Java Array Min Value minIndex(double[] x, int length)

Here you can find the source of minIndex(double[] x, int length)

Description

min Index

License

BSD License

Declaration

public static int minIndex(double[] x, int length) 

Method Source Code

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

public class Main {
    public static int minIndex(double[] x, int length) {
        double m = Double.POSITIVE_INFINITY;
        int mi = -1;
        for (int i = 0; i < length; i++)
            if (x[i] < m) {
                m = x[i];// w  w  w . j a va 2  s  .c om
                mi = i;
            }
        return mi;
    }

    public static int minIndex(int[] x, int length) {
        int m = Integer.MAX_VALUE;
        int mi = -1;
        for (int i = 0; i < length; i++)
            if (x[i] < m) {
                m = x[i];
                mi = i;
            }
        return mi;
    }
}

Related

  1. minIndex(double[] a)
  2. minIndex(double[] arr)
  3. minIndex(double[] list)
  4. minIndex(double[] v)
  5. minIndex(double[] value)
  6. minIndex(double[][] matrix, int column)
  7. minIndex(final double[] array)
  8. minIndex(final double[] values)
  9. minIndex(float[] arr)