Answers for "how to get max and min in 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
-2

max long value java

/**
 * A simple application that looks up the value of Long.MAX_VALUE and outputs it to the user.
 **/
public class Test {
	public static void main(String[] args) {
		System.out.println("The maximum Long value is: "+Long.MAX_VALUE);
	}
}
Posted by: Guest on November-27-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language