Here you can find the source of getMaxValIndex(List
Parameter | Description |
---|---|
vals | a parameter |
public static int getMaxValIndex(List<Double> vals)
//package com.java2s; import java.util.List; public class Main { /**/*from www. j av a2s . c om*/ * @param vals * @return */ public static int getMaxValIndex(List<Double> vals) { Double maxVal = Double.MIN_VALUE; int maxValIndex = 0; int i = 0; for (Double val : vals) { if (val > maxVal) { maxVal = val; maxValIndex = i; } i++; } return maxValIndex; } }