What is Integer.MAX_VALUE?

What are Integers?

Integers are numbers that can be written without a fractional component. For example 1,2,3,4,5 are all integers; whereas. 1.2,3.4,4.5 are not.

Integers in Java

Integers in Java are represented in 2’s complement binary where each integer gets 32-bits of space. In 32- bits of space, where one bit is used to represent the sign, you can represent that many values.

The maximum positive number would be 2^31 - 1.

Why 31-bits?

The 32nd bit is used to represent the sign; hence, we use 31-bits for the number. If the first bit is 1 and all the other 31 bits are 0 then the number will be the maximum negative number.

class MaxInt {
public static void main( String args[] ) {
System.out.println(Integer.MAX_VALUE);
}
}

Integer.MAX_VALUE represents the maximum positive integer value that can be represented in 32 bits (i.e., 2147483647). This means that no number of type Integer that is greater than 2147483647 can exist in Java.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved