| Author |
parseInt throwing exception
|
prav ba
Greenhorn
Joined: Jun 17, 2007
Posts: 12
|
|
hi all, am doing something really simple (at least looks simple to me) but i get a java.lang.NumberFormatException: For input string: "70611111111111111111111111111111111111" all my code does it try and parse a string, does this error mean the integer value of the string passed in is too big ?? code: java.lang.Integer.parseInt(str); thanks.
|
 |
Steve Luke
Bartender
Joined: Jan 28, 2003
Posts: 3026
|
|
|
Yup, number is too big. You might try using instead.
|
Steve
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32611
|
|
|
It's always worth looking in the API dopcumentation.
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12907
|
|
An int in Java is 32 bits, and is stored in two's complement format. Because of this, the largest positive value that you can store in an int is 2^31 - 1 = 2147483647
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: parseInt throwing exception
|
|
|