In C, the language itself does not determine the representation of certain datatypes. It can vary from machine to machine, on embedded systems the int can be 16 bit wide, though usually it is 32 bit.

The only requirement is that short int <= int <= long int by size. Also, there is a recommendation that int should represent the native capacity of the processor.

All types are signed. The unsigned modifier allows you to use the highest bit as part of the value (otherwise it is reserved for the sign bit).

Here's a short table of the possible values for the possible data types:

          width                     minimum                         maximum
signed    8 bit                        -128                            +127
signed   16 bit                     -32 768                         +32 767
signed   32 bit              -2 147 483 648                  +2 147 483 647
signed   64 bit  -9 223 372 036 854 775 808      +9 223 372 036 854 775 807
unsigned  8 bit                           0                            +255
unsigned 16 bit                           0                         +65 535
unsigned 32 bit                           0                  +4 294 967 295
unsigned 64 bit                           0     +18 446 744 073 709 551 615

In Java, the Java Language Specification determines the representation of the data types.

The order is: byte 8 bits, short 16 bits, int 32 bits, long 64 bits. All of these types are signed, there are no unsigned versions. However, bit manipulations treat the numbers as they were unsigned (that is, handling all bits correctly).

The character data type char is 16 bits wide, unsigned, and holds characters using UTF-16 encoding (however, it is possible to assign a char an arbitrary unsigned 16 bit integer that represents an invalid character codepoint)

          width                     minimum                         maximum

SIGNED
byte:     8 bit                        -128                            +127
short:   16 bit                     -32 768                         +32 767
int:     32 bit              -2 147 483 648                  +2 147 483 647
long:    64 bit  -9 223 372 036 854 775 808      +9 223 372 036 854 775 807

UNSIGNED
char     16 bit                           0                         +65 535
Answer from gaborsch on Stack Overflow
🌐
CodeGym
codegym.cc › java blog › java numbers › integer max_value in java with examples
Integer MAX_VALUE in Java with Examples
December 10, 2024 - The Integer MAX_VALUE in Java is a constant that represents the maximum positive integer value. Integer.MAX_VALUE is a number in the Java Integer сlass of java.lang package. It is the maximum possible Integer number that can be represented in 32 bits. Its exact value is 2147483647 i.e.
🌐
GeeksforGeeks
geeksforgeeks.org › java › integer-max_value-and-integer-min_value-in-java-with-examples
Integer.MAX_VALUE and Integer.MIN_VALUE in Java with Examples - GeeksforGeeks
July 12, 2025 - // Java program to show // the ... System.out.println("Integer.MAX_VALUE = " + Integer.MAX_VALUE); } } ... Integer.MAX_VALUE = 2147483647 Any integer variable cannot store any value beyond this limit....
Top answer
1 of 11
450

In C, the language itself does not determine the representation of certain datatypes. It can vary from machine to machine, on embedded systems the int can be 16 bit wide, though usually it is 32 bit.

The only requirement is that short int <= int <= long int by size. Also, there is a recommendation that int should represent the native capacity of the processor.

All types are signed. The unsigned modifier allows you to use the highest bit as part of the value (otherwise it is reserved for the sign bit).

Here's a short table of the possible values for the possible data types:

          width                     minimum                         maximum
signed    8 bit                        -128                            +127
signed   16 bit                     -32 768                         +32 767
signed   32 bit              -2 147 483 648                  +2 147 483 647
signed   64 bit  -9 223 372 036 854 775 808      +9 223 372 036 854 775 807
unsigned  8 bit                           0                            +255
unsigned 16 bit                           0                         +65 535
unsigned 32 bit                           0                  +4 294 967 295
unsigned 64 bit                           0     +18 446 744 073 709 551 615

In Java, the Java Language Specification determines the representation of the data types.

The order is: byte 8 bits, short 16 bits, int 32 bits, long 64 bits. All of these types are signed, there are no unsigned versions. However, bit manipulations treat the numbers as they were unsigned (that is, handling all bits correctly).

The character data type char is 16 bits wide, unsigned, and holds characters using UTF-16 encoding (however, it is possible to assign a char an arbitrary unsigned 16 bit integer that represents an invalid character codepoint)

          width                     minimum                         maximum

SIGNED
byte:     8 bit                        -128                            +127
short:   16 bit                     -32 768                         +32 767
int:     32 bit              -2 147 483 648                  +2 147 483 647
long:    64 bit  -9 223 372 036 854 775 808      +9 223 372 036 854 775 807

UNSIGNED
char     16 bit                           0                         +65 535
2 of 11
84

In C, the integer(for 32 bit machine) is 32 bit and it ranges from -32768 to +32767.

Wrong. 32-bit signed integer in 2's complement representation has the range -231 to 231-1 which is equal to -2,147,483,648 to 2,147,483,647.

🌐
Educative
educative.io › answers › what-is-integermaxvalue
What is 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.
🌐
TutorialKart
tutorialkart.com › java › java-integer-max
Java Integer.max() - Syntax & Examples
July 19, 2021 - public class Example { public static void main(String[] args){ int a = 7; int b = 5; int result = Integer.max(a, b); System.out.println("Result of max("+a+", "+b+") = " + result); } } ... In this Java Tutorial, we have learnt the syntax of Java ...
🌐
Runestone Academy
runestone.academy › ns › books › published › apcsareview › VariableBasics › minAndMax.html
3.7. Integer Min and Max — AP CSA Java Review - Obsolete
Integers in Java are represented in 2’s complement binary and each integer gets 32 bits of space. In 32 bits of space with one bit used to represent the sign you can represent that many values. Why is there one more negative number than positive number? It is because 0 is considered a positive number. What do the last two lines print out? Did this surprise you? Java will actually return the maximum integer value if you try to subtract one from the minimum value.
🌐
Java Code Geeks
examples.javacodegeeks.com › home › java development › core java
Java Max Int Example - Java Code Geeks
June 15, 2020 - According to java, int data type is 32-bit signed two’s complement integer, which has a range from [ -2^31,2^31-1]. Create a new class with name MaxIntegerExample1 and copy-paste the following code :
🌐
TutorialsPoint
tutorialspoint.com › article › integer-max-value-and-integer-min-value-in-java-with-examples
Integer.MAX_VALUE and Integer.MIN_VALUE in Java with Examples
July 20, 2023 - In the end, print the results and exit. public class Example2 { public static void main(String[] args) { // initializing an array of integers int[] numericList = {10, -5, 3, 7, 15}; // storing the minimum and maximum values int smlst = ...
Find elsewhere
🌐
iO Flood
ioflood.com › blog › integer-max-value-java
Java's Integer.MAX_VALUE Explained: A Complete Guide
March 11, 2024 - In Java, The Integer.MAX_VALUE function returns the maximum value that an integer can have. This value is 2,147,483,647 which is the same as 2^31 – 1. ... In this example, we declare an integer max and assign it the value of Integer.MAX_VALUE.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › Integer.html
Integer (Java Platform SE 8 )
2 days ago - A constant holding the minimum value an int can have, -231. ... A constant holding the maximum value an int can have, 231-1.
🌐
BeginnersBook
beginnersbook.com › 2022 › 10 › java-integer-max-method
Java Integer max() Method
October 25, 2022 - public class JavaExample { public static void main(String[] args) { int a = -1001, b = Integer.MIN_VALUE; System.out.println("Given integers are: "+a+", "+b); System.out.println("Greater of these two numbers: "+ Integer.max(a,b)); } }
🌐
Scaler
scaler.com › home › topics › max function in java
Max Function in Java - Scaler Topics
April 20, 2024 - The max() method is an inbuilt method of Math class which is present in java.lang package that is used to find the maximum of two numbers. The max() method takes two inputs that are of types numbers, i.e., int, long, float, double, and returns the maximum of the given numbers.
🌐
Tutorialspoint
tutorialspoint.com › java › lang › math_max_int.htm
Java - Math max(int x, int y) Method
This method returns the larger ... { // get two int numbers int x = 60984; int y = 497; // call max and print the result System.out.println("Math.max(" + x + "," + y + ")=" + Math.max(x, y)); } }...
🌐
TutorialsPoint
tutorialspoint.com › article › what-is-the-maximum-possible-value-of-an-integer-in-java
What is the maximum possible value of an integer in Java ?
August 17, 2020 - The type is int The size is 32 ... such as type, size and max_value. The maximum value that an integer can hold can be computed by calling the integer class with the MAX_VALUE value....
🌐
Squash
squash.io › how-to-find-the-max-value-of-integer-in-java
How to Find the Max Value of an Integer in Java - Squash Labs
November 3, 2023 - In the above code snippet, the Math.max() method is used to compare Integer.MAX_VALUE and 0. Since Integer.MAX_VALUE is the largest possible value, it will be returned as the maximum value. The code then prints the result to the console. Related Article: How To Iterate Over Entries In A Java Map · - When working with integers in Java, it is essential to be aware of the maximum and minimum values that can be stored in an int variable.
🌐
Tutorialspoint
tutorialspoint.com › java › number_max.htm
Java - max() Method
double max(double arg1, double arg2) float max(float arg1, float arg2) int max(int arg1, int arg2) long max(long arg1, long arg2) ... This method accepts any primitive data type as a parameter.
🌐
Delft Stack
delftstack.com › home › howto › java › max value of integer in java
The Max Value of an Integer in Java | Delft Stack
March 11, 2025 - In this example, we initialize maxIntValue to zero and use a while loop to increment it until it becomes negative. When the loop exits, maxIntValue will be one more than the maximum integer value, so we subtract one before printing it.
🌐
Baeldung
baeldung.com › home › core concepts › programming › maximum value of an integer: java vs c vs python
Maximum Value of an Integer: Java vs C vs Python | Baeldung on Computer Science
March 18, 2024 - The only limit is the physical memory, so we can represent a huge, but still limited, range of integers. For example, with 1 kilobyte of memory, we can reach integers up to 2,466 digits long!
🌐
C# Corner
c-sharpcorner.com › article › integer-maxvalue-and-integer-minvalue-in-java
Integer.MAX_VALUE and Integer.MIN_VALUE in Java
October 9, 2025 - Because Java’s int is a 32-bit signed integer (using two’s complement representation), its range is: From -2³¹ to 2³¹ − 1, i.e., −2,147,483,648 to +2,147,483,647. ... When performing arithmetic, loops, or algorithms that approach ...