Java Array Max Value maximum(double[] list)

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

Description

Returns the maximum double in the list of doubles.

License

Open Source License

Parameter

Parameter Description
list a parameter

Declaration

public static double maximum(double[] list) 

Method Source Code

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

public class Main {
    /**/* ww w .j  ava  2  s. c om*/
     * Returns the maximum double in the list of doubles.  Assumes that
     * list is not null.
     * @param list
     * @return
     */
    public static double maximum(double[] list) {
        double max = list[0];
        for (int i = 1; i < list.length; ++i)
            if (list[i] > max)
                max = list[i];
        return max;
    }

    /**
     * Returns the maximum int in the list of ints.  Assumes that
     * list is not null.
     * @param list
     * @return
     */
    public static int maximum(int[] list) {
        int max = list[0];
        for (int i = 1; i < list.length; ++i)
            if (list[i] > max)
                max = list[i];
        return max;
    }
}

Related

  1. maxElementIndex(final double[] array)
  2. maxElementIndex(final double[] array, final int endIndex)
  3. maxFloorDiv(int c, int... vals)
  4. maxFromDoubleArray(double[] arr)
  5. maxIdx(int[] in)
  6. maximum(float[] array)
  7. maximumDouble(double... values)
  8. maximumOf(final int[] array)
  9. maxIn(double[] array)