Java Array Min Value minIndex(int[] array)

Here you can find the source of minIndex(int[] array)

Description

min Index

License

Apache License

Return

the minimum index in this array,

Declaration

public static int minIndex(int[] array) 

Method Source Code

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

public class Main {
    /**// w w w  .jav a2 s .c  o  m
     * @return the minimum index in this array,
     */
    public static int minIndex(int[] array) {
        int minIndex = 0;
        for (int i = 0; i < array.length; i++) {
            if (array[minIndex] > array[i]) {
                minIndex = i;
            }
        }
        return minIndex;
    }

    /**
     * @return the minimum index in this array,
     */
    public static int minIndex(long[] array) {
        int minIndex = 0;
        for (int i = 0; i < array.length; i++) {
            if (array[minIndex] > array[i]) {
                minIndex = i;
            }
        }
        return minIndex;
    }

    /**
     * @return the minimum index in this array,
     */
    public static int minIndex(double[] array) {
        int minIndex = 0;
        for (int i = 0; i < array.length; i++) {
            if (array[minIndex] > array[i]) {
                minIndex = i;
            }
        }
        return minIndex;
    }
}

Related

  1. minIndex(final double[] array)
  2. minIndex(final double[] values)
  3. minIndex(float[] arr)
  4. minIndex(float[] vals)
  5. minIndex(float[] xs)
  6. minIndex(int[] from)
  7. minIndex(int[] ints)
  8. minIndex(int[] values)
  9. minIndex(Number[] array)