Java Array Max Value argmax(double[] weights)

Here you can find the source of argmax(double[] weights)

Description

argmax

License

Open Source License

Declaration

static int argmax(double[] weights) 

Method Source Code

//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;
    }
}

Related

  1. argmax(double[] array, boolean naturalNumbers)
  2. argmax(final double[] vec)
  3. argmax(float[] args)
  4. argMax(int[] a)
  5. argmax(int[] a)