Java Array Max Value max(final int... array)

Here you can find the source of max(final int... array)

Description

Find maximum out of Integer array

License

Open Source License

Parameter

Parameter Description
array a parameter

Return

int

Declaration

public static int max(final int... array) 

Method Source Code

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

public class Main {
    /**/*w  ww. j  a  v  a  2  s.  c om*/
     * Find maximum out of Integer array
     * 
     * @param array
     * @return {@link int}
     */
    public static int max(final int... array) {
        if (array == null) {
            return 0;
        }
        int max = array[0];
        for (int i = 0; i < array.length; i++) {
            if (array[i] > max) {
                max = array[i];
            }
        }
        return max;
    }
}

Related

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