Here you can find the source of argmax(double[] weights)
static int argmax(double[] weights)
//package com.java2s; //License from project: Open Source License public class Main { static int argmax(double[] weights) { if (weights == null) return -1; if (weights.length == 1) return 0; double max = weights[0]; int maxI = 0; for (int i = 1; i < weights.length; i++) if (weights[i] > max) maxI = i;//www.j a va 2 s . co m return maxI; } }