File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes parseInt throwing exception Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "parseInt throwing exception" Watch "parseInt throwing exception" New topic
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
    
    4

Yup, number is too big. You might try using instead.


Steve
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32611
    
    4
It's always worth looking in the API dopcumentation.
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12907
    
    3

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
 
jQuery in Action, 2nd edition
 
subject: parseInt throwing exception
 
Similar Threads
Digest: How do I generate a SHA or SHA-1 message digest?
main(String[]args)
jQuery select default item in select
replaceall() doubt
Interning