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
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.

🌐
Tutorialspoint
tutorialspoint.com › home › java › find maximum number in java
Find Maximum Number in Java
September 1, 2008 - public class Test { public static void main(String args[]) { System.out.println(Math.max(12.123, 12.456)); System.out.println(Math.max(23.12, 23.0)); } }
🌐
iO Flood
ioflood.com › blog › integer-max-value-java
Java's Integer.MAX_VALUE Explained: A Complete Guide
March 11, 2024 - In Java, Integer.MAX_VALUE is a constant in the Integer class that holds the maximum possible value for an integer, which is 2,147,483,647. But why this specific number? The reason lies in how integers are represented in binary form in computer ...
🌐
W3Schools
w3schools.com › java › ref_math_max.asp
Java Math max() Method
Tip: Use the min() method to return the number with the lowest value. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com · HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
🌐
CodeGym
codegym.cc › java blog › java numbers › integer max_value in java with examples
Integer MAX_VALUE in Java with Examples
December 10, 2024 - 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.
🌐
Runestone Academy
runestone.academy › ns › books › published › › apcsareview › VariableBasics › minAndMax.html
3.7. Integer Min and Max — AP CSA Java Review - Obsolete
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.
🌐
Scaler
scaler.com › home › topics › max function in java
Max Function in Java - Scaler Topics
April 20, 2024 - The first answer is you compare both real numbers using comparison operators like greater-than (>) or less-than (<) operators and find the maximum number. The second method is to take the help of the inbuilt max() method of Math class in Java ...
🌐
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 - Integer.MAX_VALUE Integer.MAX_VALUE is a constant in the Integer class of java.lang package that specifies that stores the maximum possible value for any integer variable in Java.
Find elsewhere
🌐
TutorialsPoint
tutorialspoint.com › java-program-to-find-maximum-of-three-numbers
Java program to find maximum of three numbers
If the first condition is false, we move on to the else if condition, where we check if num2 is greater than or equal to both num1 and num3. If this condition is satisfied, num2 is printed as the maximum. If neither the first nor the second condition is true, then by default, num3 must be the largest, so the program prints num3 as the maximum number.
🌐
Quora
quora.com › How-come-the-maximum-value-of-int-is-2-147-483-647-in-Java
How come the maximum value of int is 2,147,483,647 in Java? - Quora
When you have 32 bits all of them are ones, you have 2^{32}-1 which equals 4294967295. So this is the maximum number that an unsigned int can hold. Note that the minimum number an unsigned int...
🌐
Vultr Docs
docs.vultr.com › java › standard-library › java › lang › Math › max
Java Math max() - Find Maximum Value | Vultr Docs
December 3, 2024 - Define two integer variables. Use the Math.max() method to determine which variable holds the larger value. ... int a = 5; int b = 10; int maximum = Math.max(a, b); System.out.println("The maximum value is: " + maximum); Explain Code
🌐
CodeGym
codegym.cc › java blog › java math › java math max() method
Java Math.max() method with Examples
December 5, 2024 - It is a static method, and therefore, you use it with the class name as Math.max. This Math.max() method can only take two arguments, so you can’t use it to find a Maximum number in a set with more than two numbers. It has four overloading methods for int, double, float, and long data types.
🌐
Tutorialspoint
tutorialspoint.com › java › lang › math_max_int.htm
Java - Math max(int x, int y) Method
The java.lang.Math.max(int a, int b) returns the greater of two int values. That is, the result is the argument closer to positive infinity. If the arguments have the same value, the result is that same value.
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-math-max-method
Java Math max() Method - GeeksforGeeks
May 14, 2025 - Return Type: The function returns maximum of two numbers. The datatype will be the same as that of the arguments. Let's now discuss some examples for better understanding. Example 1: In this example, we will see the basic usage of Math.max() ...
🌐
Upgrad
upgrad.com › home › tutorials › software & tech › the max function in java
Max Function in Java: A Complete Guide with Practice Exercises
March 18, 2025 - The Math.max() function in Java is a predefined method that is deployed to find the greater of two values. This approach streamlines the process of evaluating two numbers and identifying the greater one, which is a frequent action in various ...
🌐
Quora
quora.com › What-is-the-largest-number-Java-can-handle
What is the largest number Java can handle? - Quora
Answer (1 of 3): Out of the box, you can use this namespace: [code]import java.math.BigInteger; [/code]Which gives you access to: [code]BigInteger and BigDecimal. [/code]If you read the docs BigInteger (Java Platform SE 8 ) it mentions that: > [code ]BigInteger[/code] must support values in t...
🌐
GeeksforGeeks
geeksforgeeks.org › java › min-and-max-in-a-list-in-java
Min and Max in a List in Java - GeeksforGeeks
November 7, 2018 - In Java, we can find the smallest (minimum) and largest (maximum) numbers in a list of integers in different ways: by sorting the list, using built-in methods like Collections.min() and Collections.max(), or by checking each number one by one. Each way works, but some are faster and use less memory than others.
🌐
Medium
medium.com › @idiotN › java-8-max-method-example-b6932299d759
java 8 max() method example. In Java 8, the max() method is used to… | by idiot | Medium
February 25, 2024 - Here’s an example of how to use the max() method to find the maximum element in a stream of integers: import java.util.Arrays; import java.util.List; import java.util.Optional; public class Main { public static void main(String[] args) { ...
🌐
Codecademy
codecademy.com › docs › java › math methods › .max()
Java | Math Methods | .max() | Codecademy
October 22, 2022 - Learn to code in Java — a robust programming language used to create software, web and mobile apps, and more. Beginner Friendly.Beginner Friendly17 hours17 hours ... The .max() method takes two parameters num1 and num2. num1 and num2 can be of type int, float, double or long. The following example uses the .max() method to print the maximum of two numbers: