• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

parseInt throwing exception

 
prav ba
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 4181
21
IntelliJ IDE Java Python
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, number is too big. You might try using instead.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47231
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's always worth looking in the API dopcumentation.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic