Java Reference

Java Reference Home | Smart Soft Home

Java Data Types
Integral Typesbyte1 bytefrom -128 to 127, inclusive
short2 bytefrom -32768 to 32767, inclusive
int4 bytefrom -2147483648 to 2147483647, inclusive
long8 bytefrom -9223372036854775808 to 9223372036854775807, inclusive
Floating Point Typesfloat4 bytesSee note
double8 bytesSee note
Other Typeschar2 bytesfrom '\u0000' to '\uffff' inclusive, that is, from 0 to 65535
booleann/atrue or false

Char

Technically, a char is an integral type, since chars are unicode integer values that represent characters.

Float & Double

The range of float is determined by the following formula:

s * m * 2^e

where:
  s is -1 or +1
  m is from 0 to 2^34
  e is from -149 to 104

The range of double is determined by the same formula:

where:
  s is -1 or +1
  m is from 0 to 2^53
  e is from -1075 and 970