Java Array Max Value max(final long[] longs)

Here you can find the source of max(final long[] longs)

Description

Get the maximum element in an array of longs.

License

Apache License

Parameter

Parameter Description
longs the array to search.

Return

the maximum value in the array.

Declaration

public static long max(final long[] longs) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**/*from www  .j a  v  a 2s . c  om*/
     * Get the maximum element in an array of longs.
     * @param longs the array to search.
     * @return the maximum value in the array.
     */
    public static long max(final long[] longs) {
        long max = 0l;
        for (int j = 0; j < longs.length; j++) {
            max = (longs[j] > max) ? longs[j] : max;
        }
        return max;
    }
}

Related

  1. max(final int... values)
  2. max(final int[] arr)
  3. max(final int[] result, final int[] vec1, final int[] vec2)
  4. max(final int[] values)
  5. max(final int[] values)
  6. max(final Number... numbers)
  7. max(final T p_enum1, final T p_enum2, final T[] enumValues)
  8. max(final T... elements)
  9. max(float... a)