Here you can find the source of argmin(double... vs)
public static int argmin(double... vs)
//package com.java2s; /*/*www.j a va 2 s . c o m*/ * MathUtil.java - math utilities * * Released as part of the Tempescope project - http://kenkawakenkenke.github.io/tempescope/ * Copyright (c) 2013 Ken Kawamoto. All right reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ public class Main { public static int argmin(double... vs) { double min = vs[0]; int minI = 0; for (int i = 1; i < vs.length; i++) { double v = vs[i]; if (v < min) { min = v; minI = i; } } return minI; } }