I am wondering how to represent 5400000000,5400000001,5400000002,…. in java
(how to represent 5 billion in java)
java ints only hold 2^32-1,
java longs hold 2^64-1,..but i am having a problem representing 5400000000,5400000001,5400000002,….and doubles aren’t helping either.
can someone plz provide insight how to represent large values like this (IN JAVA) without having to do multiplication on strings
because Long max = Long(5462205000); just isnt doing it for me.
thx in advance
Your 64-bit integer type can easily hold numbers like 5 billion. Even the signed version can hold values up to
9223372036854775807. Slow bigint libraries not necessary.To specify these in code you need to use what’s called a ‘long int literal’, which means adding an
Lto the end of the number. Example: