Java Array Max Value max(int[] data)

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

Description

max

License

LGPL

Declaration

public static double max(int[] data) 

Method Source Code

//package com.java2s;
/*/*from w  w  w  . jav  a 2 s . c om*/
This code is licensed under the LGPL v3 or greater with the classpath exception, 
with the following additions and exceptions.  
    
packages cern.* have retained the original cern copyright notices.
    
packages at.mabs.cmdline and at.mabs.util.* 
have the option to be licensed under a BSD(simplified) or Apache 2.0 or greater  license 
in addition to LGPL. 
    
Note that you have permission to replace this license text to any of the permitted licenses. 
    
Main text for LGPL can be found here:
http://www.opensource.org/licenses/lgpl-license.php
    
For BSD:
http://www.opensource.org/licenses/bsd-license.php
    
for Apache:
http://www.opensource.org/licenses/apache2.0.php
    
classpath exception:
http://www.gnu.org/software/classpath/license.html
*/

public class Main {
    public static double max(int[] data) {
        int max = -Integer.MAX_VALUE;
        for (int i : data)
            max = Math.max(max, i);
        return max;
    }
}

Related

  1. max(int[] array)
  2. max(int[] array)
  3. max(int[] array)
  4. max(int[] array)
  5. max(int[] as)
  6. max(int[] elements)
  7. max(int[] ids)
  8. max(int[] in, int x1, int x2)
  9. max(int[] list)