Answers for "get the max value in a double array java"

1

max value of double java

System.out.println(Double.MAX_VALUE);//(2-2^52)^21023, maximum value < Infinity
System.out.println(Double.POSITIVE_INFINITY);//Infinity
Posted by: Guest on April-06-2021
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

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language