Java primitive data types and precision

The following tables list the Java™ primitive data types, their description, size, and format:

Integers data types

Keyword Description Size Format
byte Byte-length integer 8-bit twos complement From +127 to -128
short Short integer 16-bit twos complement From +32767 to -32768
int Integer 32-bit twos complement From +2147483647 to -2147483648
long Long integer 64-bit twos complement From +9223372036854775807 to -9223372036854775808

Real numbers data types

Keyword Description Size Format
float Single-precision floating point 32-bit IEEE 754 From 3.4028235E38 to 1.4E-45
double Double-precision floating point 64-bit IEEE 754 From 1.7976931348623157E308 to 4.9E-324

Other data types

Keyword Description Size/Format
char A single character 16-bit Unicode character
Boolean A Boolean value (true or false) true or false

Copyright IBM Corporation 2005. All Rights Reserved.