Java Array Max Value max(final double[] vec)

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

Description

Computes the maximum of the elements of a vector.

License

Open Source License

Parameter

Parameter Description
vec the vector.

Return

the maximum of the elements of the vector.

Declaration

public static double max(final double[] vec) 

Method Source Code

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

public class Main {
    /**//from w  w w.ja  v  a 2s.co  m
    * Computes the maximum of the elements of a vector.
    * @param vec   the vector.
    * @return      the maximum of the elements of the vector.
    */
    public static double max(final double[] vec) {
        assert vec != null;

        double max = vec[0];
        for (double i : vec) {
            if (i > max) {
                max = i;
            }
        }
        return max;
    }
}

Related

  1. Max(final double[] input)
  2. max(final double[] nums)
  3. max(final double[] tab)
  4. max(final double[] target)
  5. max(final double[] values)
  6. max(final float[] a, final float[] b)
  7. max(final int... array)
  8. max(final int... integers)
  9. max(final int... numbers)