An int
can only have a maximum value of 2147483647, so if you try to parse a number larger than that you'll get an exception (since it's not a valid int
.)
Long.parseLong()
will handle larger numbers, though bear in mind it still has an upper limit (2^63-1). If you really need a type without an upper limit, you'll have to use BigInteger (which has a constructor that takes a string.)
(You can find more information on all the primitive data types and their maximum values here.)