Oct 08 2009

Java primitive data type sizes for byte, short, int, long, float, double and char

Published by at 2:32 pm under Java

A handy list for Java data types and sizes

Integer Data Types

Data Type Size Digits Min Max
byte 8-bit signed 3 -128 127
short 16-bit signed 5 -32,768 32,767
int 32-bit signed 10 -2,147,483,648 2,147,483,647
long 64-bit signed 19 -9,223,372,036,854,775,808 9,223,372,036,854,775,807

Floating Point Data Types

Data Type Size
float single-precision 32-bit IEEE 754 floating point
double double-precision 64-bit IEEE 754 floating point

Boolean Data Types

Data Type Values
boolean true or false

Character Data Types

Data Type Min Max
char u0000 or 0 uffff or 65,535

Default Values

Data Type Default Value
byte 0
short 0
int 0
long 0L
float 0.0f
double 0.0d
char ‘u0000’
boolean false
Any Object(s) null

References:
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html

No responses yet

Leave a Reply