Java Array Max Value max(int[] arr)

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

Description

max

License

Open Source License

Declaration

static public int max(int[] arr) 

Method Source Code


//package com.java2s;
import java.util.ArrayList;

public class Main {
    static public int max(int[] arr) {
        int max = Integer.MIN_VALUE;
        for (int i : arr)
            max = Math.max(max, i);

        return max;
    }//from  www. ja va  2  s  . co m

    static public int max(ArrayList<Integer> arrlist) {
        int max = Integer.MIN_VALUE;
        for (int i : arrlist)
            max = Math.max(max, i);

        return max;
    }

    static public double max(double[] arr) {
        double max = Double.MIN_VALUE;
        for (double x : arr)
            max = Math.max(max, x);

        return max;
    }
}

Related

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