Answers for "find max value in array with million records java"

3

how to get the max value of an array java

public static double arrayMax(double[] arr) {
    double max = Double.NEGATIVE_INFINITY;

    for(double cur: arr)
        max = Math.max(max, cur);

    return max;
}
Posted by: Guest on May-10-2020
0

array find max in java

public static void main(String[] args) {
        int [] arr = {100,200,300,50,40,-10,-50};
        int max = Integer.MIN_VALUE;
        for(int each: arr)
            if(each > max)
                max = each;
        System.out.println(max); // 300
Posted by: Guest on June-09-2021

Code answers related to "find max value in array with million records java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language