Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How many bytes does int occupy in java?
How many bytes does int occupy in java?
This is the number of bytes occupied by the basic type memory in units of 8 (the value range is 2 (number of bytes X8- 1)).

1. integer

Value range of digits required for type storage

Byte 1 byte1* 8 (-2 power of 3 1 to 2 power of 31-1)

Short 2 bytes 2 * 8-32768 ~ 32767

Int 4 byte 4*8 (-2 to the 63rd power 2-1)

8 bytes long, 8 * 8- 128 ~ 127

2. Floating-point type

A note on the number of bits required for type storage

Floating-point 4 bytes, 4*8 floating-point values have a suffix f (for example, 3. 14F).

Double 8 bytes 8*8 Floating-point values without suffix f (such as 3. 14) are double by default.

3. Character type

Number of bits required for type storage

Character 2 Byte 2*8

4. Boolean type

Value range of digits required for type storage

Boolean type 1 byte 1*8 false, true