Why is this happening? The string I'm parsing looks clearly like an int. The program is reading from a file, and I know that it's working for the most because this number is way down the list. Any ideas? Also, the program is parsing ints larger than 2.2 billion, so I don't know if it's a size issue.
A signed 32-bit int can only be as large as 2^31, or 0x7FFFFFFF (2,147,483,647). You'll need to use a bigger datatype. long will get you up to 2^63. Or the BigInteger class will get you an arbitrary sized integer.
int can have a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647 (inclusive), Your number(from string) falls out of the range
Use long instead Long.parseLong(3291105000) would work for you
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