jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes parseInt throwing exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
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: 4181
    
  21

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


Steve
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 44590
    
  34
It's always worth looking in the API dopcumentation.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15002
    
  27

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 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: parseInt throwing exception
 
It's not a secret anymore!