Here you can find the source of min(double[] numbers)
public static int min(double[] numbers)
//package com.java2s; // are made available under the terms of the Eclipse Public License v1.0 public class Main { public static int min(double[] numbers) { if (numbers.length == 0) return -1; double min = numbers[0]; int id = 0; for (int i = 1; i < numbers.length; i++) { double n = numbers[i]; if (n < min) { min = n;// ww w. j av a2s . c o m id = i; } } return id; } /** * @param numbers * @return * index of the smallest number in the given array */ public static int min(int[] numbers) { if (numbers.length == 0) return -1; int min = numbers[0]; int id = 0; for (int i = 1; i < numbers.length; i++) { int n = numbers[i]; if (n < min) { min = n; id = i; } } return id; } }