Long max value in Java

Long is stored in 64 bits of memory. To find max and min values of Long in Java we can use inbuilt fields of Long class :

  • Long.MAX_VALUE = 9223372036854775807
  • Long.MIN_VALUE = -9223372036854775808

Let us look at the example code :

public class MaxValue {

	public static void main(String[] args) {

		System.out.println("Long maximum value = "+Long.MAX_VALUE);
		System.out.println("Long minimum value = "+Long.MIN_VALUE);
	}

}

Output

Long maximum value = 9223372036854775807
Long minimum value = -9223372036854775808

Leave a Comment