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
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › Integer.html
Integer (Java Platform SE 8 )
April 21, 2026 - The number of bytes used to represent a int value in two's complement binary form. ... Constructs a newly allocated Integer object that represents the specified int value.
🌐
Runestone Academy
runestone.academy › runestone › static › JavaReview › VariableBasics › minAndMax.html
3.7. Integer Min and Max — AP CSA Java Review - Obsolete
The int type in Java can be used to represent any whole number from -2147483648 to 2147483647. Why those numbers? 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 ...
Discussions

java - max value of integer - Stack Overflow
In C, the integer (for 32 bit machine) is 32 bits, and it ranges from -32,768 to +32,767. In Java, the integer(long) is also 32 bits, but ranges from -2,147,483,648 to +2,147,483,647. I do not More on stackoverflow.com
🌐 stackoverflow.com
[Java] What is the best way to read a user defined integer value?
On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge. If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options: Limiting your involvement with Reddit, or Temporarily refraining from using Reddit Cancelling your subscription of Reddit Premium as a way to voice your protest. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/learnprogramming
6
3
August 22, 2023
Is it “int” or “integer”?
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full - best also formatted as code block You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit/markdown editor: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/learnjava
16
10
August 11, 2024
utilities - Checking if a number is an Integer in Java - Stack Overflow
Is there any method or quick way to check whether a number is an Integer (belongs to Z field) in Java? I thought of maybe subtracting it from the rounded number, but I didn't find any method that ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
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.
🌐
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 - Example 2: Trying to initialize ... + " Integer.MAX_VALUE + 1"); // Try to store value Integer.MAX_VALUE + 1 int N = Integer.MAX_VALUE + 1; // Print the value of N System.out.println("N = " + N); } catch (Exception e) { ...
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.

🌐
W3Schools
w3schools.com › java › java_data_types.asp
Java Data Types
Java Examples Java Videos Java Compiler Java Exercises Java Quiz Java Code Challenges Java Practice Problems Java Server Java Syllabus Java Study Plan Java Interview Q&A ... int myNum = 5; // Integer (whole number) float myFloatNum = 5.99f; // Floating point number char myLetter = 'D'; // Character boolean myBool = true; // Boolean String myText = "Hello"; // String ... Non-primitive data types - such as String, Arrays and Classes (you will learn more about these in a later chapter) A primitive data type specifies the type of a variable and the kind of values it can hold.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › java › integer-intvalue-method-in-java
Integer intValue() Method in Java - GeeksforGeeks
July 11, 2025 - ... // Java Program to illustrate // Usage of intValue() method // of Integer class of java.lang package // Importing required classes import java.lang.*; // Main class class GFG { // Main driver method public static void main(String[] args) ...
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › int-vs-Integer-java-difference-comparison-primitive-object-types
Integer vs. int: What's the difference?
The Integer consumes slightly more memory than the 32-bit Java int. The Integer class has five static properties while the int can’t have any. The Integer class has two constructors while the int can’t have any. The Integer class has over 30 static methods, while the int can’t have any. The Integer class has over a dozen instance methods, while the int can’t have any. You can convert text Strings to int values with Integer, but you can’t with the int.
🌐
Reddit
reddit.com › r/learnprogramming › [java] what is the best way to read a user defined integer value?
r/learnprogramming on Reddit: [Java] What is the best way to read a user defined integer value?
August 22, 2023 -

I'm brushing up on my Java programming by going through the free Java course through the University of Finland. In the course, they teach that the only way to read a user define integer is to do the following:

int value = Integer.valueOf(scanner.nextLine());

But, back when I was in college, we were taught that using the following was okay as well:

int value = scanner.nextInt();

Which one is actually correct or are they both right?

🌐
Java Guides
javaguides.net › 2024 › 06 › java-integer-intvalue-method.html
Java Integer intValue() Method
June 17, 2024 - The Integer.intValue() method is an instance method in the Integer class in Java. It converts an Integer object to an int primitive. This method is useful when you need to perform operations that require int primitives on Integer objects.
🌐
Swagger
swagger.io › specification
OpenAPI Specification - Version 3.1.0 | Swagger
Note that the type keyword allows "integer" as a value for convenience, but keyword and format applicability does not recognize integers as being of a distinct JSON type from other numbers because [[RFC7159|JSON]] itself does not make that distinction. Since there is no distinct JSON integer type, JSON Schema defines integers mathematically.
🌐
Java Almanac
javaalmanac.io › jdk › 1.2 › api › java › lang › Integer.html
Java Platform 1.2 API Specification: Class Integer
the value 0 if the argument is a Integer numerically equal to this Integer; a value less than 0 if the argument is a Integer numerically greater than this Integer; and a value greater than 0 if the argument is a Integer numerically less than this Integer. ... ClassCastException - if the argument ...
🌐
Wikipedia
en.wikipedia.org › wiki › Integer_overflow
Integer overflow - Wikipedia
April 13, 2026 - When they reach level 22, the time/bonus number is 260, which is too large for its 8-bit 256 value register, so it overflows to a value of 4—too short to finish the level. Overflow is the cause of the "split-screen" level in Pac-Man. Such a bug also caused the Far Lands in Minecraft Java Edition ...
🌐
Learnsic
learnsic.com › blog › working-with-the-integer-class-in-the-java-programming-language
Working with the Integer Class in the Java Programming ...
This website uses cookies to ensure you get the best experience & by continuing to use our website, you agree to our Privacy and Cookie Policy · Got it
🌐
W3Schools
w3schools.com › java › java_variables.asp
Java Variables
In Java, there are different types of variables, for example: String - stores text, such as "Hello". String values are surrounded by double quotes · int - stores integers (whole numbers), without decimals, such as 123 or -123
🌐
DataCamp
datacamp.com › doc › java › int
int Keyword in Java: Usage & Examples
The int data type is used to store integer values without decimal points. It can store values ranging from -2,147,483,648 to 2,147,483,647.
🌐
Kotlin
kotlinlang.org › docs › basic-syntax.html
Basic syntax overview | Kotlin Documentation
A reference must be explicitly marked as nullable when a null value is possible. Nullable type names have ? at the end. For example, Int?. Return null if str does not hold an integer: fun parseInt(str: String): Int? { return str.toIntOrNull() } Use a function returning nullable value: fun parseInt(str: String): Int?