Archiv für Februar 2006

Java data types

Februar 28, 2006

An overview of the primitive java data types extended with the possible range of values (source: merge of the official sun pages and cafeaulait).

Keyword Description Size/Format Values from-to
Integers
byte Byte-length integer 8-bit two's complement -128 to 127
short Short integer 16-bit two's complement -32,768 to 32,767
int Integer 32-bit two's complement -2,147,483,648 to 2,147,483,647
long Long integer 64-bit two's complement -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807
Real numbers
float Single-precision floating point 32-bit IEEE 754 1.40129846432481707e-45 to 3.40282346638528860e+38 (positive or negative)
double Double-precision floating point 64-bit IEEE 754 4.94065645841246544e-324d to 1.79769313486231570e+308d (positive or negative)
Other types
char A single character 16-bit Unicode character 0 to 65,535
boolean A boolean value (true or false) true or false 0 or 1