long

The type long is a 64-bit, signed, two's-complement quantity. It should be used when calculations on whole numbers may exceed the range of int. Using longs, the range of values is –263 to (263–1). Numbers up in this range will be increasingly prevalent in computing, and 264 in particular is a number that really needs a name of its own. In 1993, I coined the term “Bubbabyte” to describe 264 bytes. Just as 210 bytes is a Kilobyte, and 220 is a Megabyte, so 264 bytes is a Bubbabyte. Using a long, you can count up to half a Bubbabyte less one.

example declaration:

long nationalDebt;

range of values: –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

Get Just Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.