Java Array Max Value max(int[] a)

Here you can find the source of max(int[] a)

Description

Returns the biggest integer value of the array.

License

Open Source License

Declaration

public static int max(int[] a) 

Method Source Code

//package com.java2s;
/* @(#)ArrayUtil.java// w  w w. j a  v  a 2s  . c  o  m
 *
 * Copyright (c) 2003 Werner Randelshofer, Switzerland. MIT License.
 *
 * Implementation derived from Sun's Java 1.4 VM.
 */

public class Main {
    /**
     * Returns the biggest integer value of the array.
     */
    public static int max(int[] a) {
        int v = Integer.MIN_VALUE;
        for (int i = a.length - 1; i != -1; i--) {
            if (a[i] > v)
                v = a[i];
        }
        return v;
    }
}

Related

  1. max(int... values)
  2. max(int... values)
  3. max(int... values)
  4. max(int... xs)
  5. max(int[] a)
  6. max(int[] arr)
  7. max(int[] arr)
  8. max(int[] arr)
  9. max(int[] arr)