Java Array Max Value maxLocation(double[] list)

Here you can find the source of maxLocation(double[] list)

Description

This method finds the location of the first minimum of list

License

Open Source License

Parameter

Parameter Description
list a list of doubles

Return

the location of the first occurence of the minimum element

Declaration

public static int maxLocation(double[] list) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**// w w  w  .  ja v a 2s .  c om
     * This method finds the location of the first minimum of list
     * @param list a list of doubles
     * @return the location of the first occurence of the minimum element
     */
    public static int maxLocation(double[] list) {
        int location = 0;
        for (int i = 1; i < list.length; ++i)
            if (list[i] > list[location])
                location = i;

        return location;
    }

    /**
     * This method finds the location of the first minimum of list
     * @param list a list of doubles
     * @return the location of the first occurence of the minimum element
     */
    public static int maxLocation(int[] list) {
        int location = 0;
        for (int i = 1; i < list.length; ++i)
            if (list[i] > list[location])
                location = i;

        return location;
    }
}

Related

  1. maxInVector(double[] _vector)
  2. maxJoinArray(float[] array1, float[] array2)
  3. maxLength(String... array)
  4. maxLikelihood(int[] i, long[] Xi)
  5. maxLimit(int receiver, int... maxBound)
  6. maxNorm(double[] arr)
  7. maxNorm(double[] x1, double[] x2)
  8. maxNormWithAbort(double[] x1, double[] x2, double limit)
  9. maxNum(Number iArr[])