Java Get Maximum Long Value

Tags: long

In this Java core tutorial we learn how to get the maximum long value in Java programming language.

How to get maximum long value in Java

In Java, to get the maximum long value we can use the Long.MAX_VALUE constant as the following example Java program.

GetMaxLongExample.java

public class GetMaxLongExample {
    public static void main(String... args) {
        // Get maximum Long value
        long maxLong = Long.MAX_VALUE;

        System.out.println("Maximum Long Value: " + maxLong);
    }
}
The output as below.
Maximum Long Value: 9223372036854775807

Happy Coding 😊

Java Get Minimum Long Value