Java Array Max Value max(double values[])

Here you can find the source of max(double values[])

Description

Finds maximum value in the given vector.

License

Open Source License

Parameter

Parameter Description
values the vector

Return

the maximum in the given vector

Declaration

public static double max(double values[]) 

Method Source Code

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

public class Main {
    /**// ww w. j av a2  s .co  m
     * Finds maximum value in the given vector.
     * @param values the vector
     * @return the maximum in the given vector
     */
    public static double max(double values[]) {
        double max = Double.NEGATIVE_INFINITY;
        for (double value : values) {
            if (value > max)
                max = value;
        }
        return max;
    }

    /**
     * Finds maximum value in the given vector.
     * @param values the vector
     * @return the maximum in the given vector
     */
    public static int max(int values[]) {
        int max = Integer.MIN_VALUE;
        for (int value : values) {
            if (value > max)
                max = value;
        }
        return max;
    }
}

Related

  1. max(byte[] array)
  2. max(byte[] lArray, byte[] rArray)
  3. max(byte[] values)
  4. max(D... comparables)
  5. max(double array[], int start, int length)
  6. max(double values[], int size)
  7. max(double... a)
  8. max(double... arr)
  9. max(double... ds)