Java Array Max Value max(int[] array)

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

Description

max

License

Open Source License

Declaration

public static int max(int[] array) 

Method Source Code

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

public class Main {
    public static int max(int[] array) {
        if (array.length == 0) {
            throw new RuntimeException("Array is empty.");
        }/*from   w w  w.j  a va  2s . co  m*/
        int max = array[0];
        for (int i = 0; i < array.length; i++) {
            if (array[i] > max) {
                max = array[i];
            }
        }
        return max;
    }
}

Related

  1. max(int[] arr)
  2. max(int[] arr)
  3. max(int[] arr)
  4. max(int[] arr, int count)
  5. max(int[] array)
  6. max(int[] array)
  7. max(int[] array)
  8. max(int[] array)
  9. max(int[] as)