I'm getting "integer number too large: 1000000000001" for the following code line. How do I make it so that maxValue can hold 1 quadrillion or 1 trillion?
long maxValue = 1000000000001; //1,000,000,000,001
You need to use a long literal (with an L
at the end):
long maxValue = 1000000000001L; //1,000,000,000,001
Note that you don't need to use BigInteger if your numbers are between -263 and 263-1 (inclusive). (263-1 = 9223372036854775807L = 0x7fffffffffffffffL.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With