Java Language Primitive Types Cheatsheet


Table showing size and values range of all primitive types:

data typenumeric representationrange of valuesdefault value
booleann/afalse and truefalse
byte8-bit signed-27 to 27 - 10
-128 to +127
short16-bit signed-215 to 215 - 10
-32,768 to +32,767
int32-bit signed-231 to 231 - 10
-2,147,483,648 to +2,147,483,647
long64-bit signed-263 to 263 - 10L
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
float32-bit floating point1.401298464e-45 to 3.402823466e+38 (positive or negative)0.0F
double64-bit floating point4.94065645841246544e-324d to 1.79769313486231570e+308d (positive or negative)0.0D
char16-bit unsigned0 to 216 - 10
0 to 65,535


  1. The Java Language Specification mandates that signed integral types (byte through long) use binary twos-complement representation, and the floating point types use standard IEE 754 binary floating point representations.
  2. Java 8 and later provide methods to perform unsigned arithmetic operations on int and long. While these methods allow a program to treat values of the respective types as unsigned, the types remain signed types.
  3. The smallest floating point shown above are subnormal; i.e. they have less precision than a normal value. The smallest normal numbers are 1.175494351e−38 and 2.2250738585072014e−308
  4. A char conventionally represents a Unicode / UTF-16 code unit.
  5. Although a boolean contains just one bit of information, its size in memory varies depending on the Java Virtual Machine implementation (see boolean type).