Java Array Min Value minIdx(int[] in)

Here you can find the source of minIdx(int[] in)

Description

min Idx

License

Apache License

Declaration

public static final int minIdx(int[] in) 

Method Source Code

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

public class Main {
    public static final int minIdx(int[] in) {
        int out = in[0];
        for (int i = 1; i < in.length; i++) {
            if (in[i] < in[out]) {
                out = i;//from w w  w. jav a 2s. c  o  m
            }
        }
        return out;
    }

    public static final int minIdx(double[] in) {
        int out = 0;
        for (int i = 1; i < in.length; i++) {
            if (in[i] < in[out]) {
                out = i;
            }
        }
        return out;
    }

    public static final int minIdx(float[] in) {
        int out = 0;
        for (int i = 1; i < in.length; i++) {
            if (in[i] < in[out]) {
                out = i;
            }
        }
        return out;
    }
}

Related

  1. minDouble(double... values)
  2. minDoubleArray(double[] data)
  3. minElement(int[] array)
  4. minFastSort(double x[], int idx[], int n, int m)
  5. minFastSort(double[] x, int[] idx, int size)
  6. minIgnoreIndex(double[] array, int indexToIgnore)
  7. minimum(char[] set)
  8. minimum(double[] list)
  9. minimum(float[] array)