Data Type Sizes
Submitted by jeffheaton on Thu, 01/10/2008 - 03:51
Each numeric data type can hold a different sized number, the lengths of each datatype are summarized in Table 3.2.
Table 3.2: Numeric Datatype Sizes
| Datatype | Signed | Range |
|---|---|---|
| char | n/a | 16 bits |
| byte | yes | -128 to +127 (8 bits) |
| short | yes | -32,768 to +32,767 |
| int | yes | -2,147,483,648 to 2,147,483,647 (32 bits) |
| long | yes | -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 (64 bits) |
| float | yes | Float.NEGATIVE_INFINITY to Float.POSITIVE_INFINITY (32 bits) |
| double | yes | Double.NEGATIVE_INFINITY to Double.POSITIVE_INFINITY (64 bits) |
Java does not specify a maximum size for Strings, this is defined by your computer system. However, strings can become very large, if needed, up into the megabyte size range.












