Mega Code Archive

 
Categories / Java Tutorial / Data Type
 

Integer Data Types in Java

There are four types of integer data variables. They can store both negative and positive values. Data TypeValueMemory byte-128 -- +127occupy 1 byte (8 bits) in memory short-32768 -- 32767occupy 2 bytes (16 bits) in memory int-2147483648 -- 2147483647occupy 4 bytes (32 bits) in memory long-9223372036854775808 -- 9223372036854775807occupy 8 bytes (64 bits) in memory