You are viewing a single comment's thread. Return to all comments →
It's to do with the range that data type can have.
For example short can have minimum -32,768 to maximum of 32,767.
Same case for int & long, which is ONE less number for it's maximum.
It's easier to write (2^31 - 1) than it is to write 2147483648 - 1 = 2147483647
Seems like cookies are disabled on this browser, please enable them to open this website
Java Datatypes
You are viewing a single comment's thread. Return to all comments →
It's to do with the range that data type can have.
For example short can have minimum -32,768 to maximum of 32,767.
Same case for int & long, which is ONE less number for it's maximum.
It's easier to write (2^31 - 1) than it is to write 2147483648 - 1 = 2147483647