Here you can find the source of maxIndex(double[] arr)
Parameter | Description |
---|---|
arr | a parameter |
public static int maxIndex(double[] arr)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w ww.j a va 2s .c o m * max index in array * * @param arr * @return */ public static int maxIndex(double[] arr) { double max = arr[0]; int index = 0; // for (double val : arr) { for (int i = 0; i < arr.length; i++) { double val = arr[i]; if (val > max) { max = val; index = i; } } return index; } }