Here you can find the source of minIndex(int[] values)
public static int minIndex(int[] values)
//package com.java2s; //License from project: Open Source License public class Main { public static int minIndex(int[] values) { return minIndex(values, 0, values.length); }//from w ww .ja va 2 s . c o m public static int minIndex(int[] values, int begin, int end) { int min = Integer.MAX_VALUE; int index = -1; if (checkArguments(values, begin, end)) { min = values[begin]; index = begin; for (int i = begin; i < end; i++) { if (values[i] < min) { min = values[i]; index = i; } } } return index; } public static int minIndex(double[] values) { return minIndex(values, 0, values.length); } public static int minIndex(double[] values, int begin, int end) { double min = Double.NaN; int index = -1; if (checkArguments(values, begin, end)) { min = values[begin]; index = begin; for (int i = begin; i < end; i++) { if (!Double.isNaN(values[i])) { if (values[i] < min) { min = values[i]; index = i; } } } } return index; } private static boolean checkArguments(final int[] values, final int begin, final int end) { if (values == null || values.length == 0) { return false; } if (begin < 0 || end >= values.length) { return false; } return true; } private static boolean checkArguments(final double[] values, final int begin, final int end) { if (values == null || values.length == 0) { return false; } if (begin < 0 || end > values.length) { return false; } return true; } }