wood burning stoves 2.0*
The moose likes Java in General and the fly likes java.lang.NumberFormatException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "java.lang.NumberFormatException" Watch "java.lang.NumberFormatException" New topic
Author

java.lang.NumberFormatException

nikil shar
Ranch Hand

Joined: May 25, 2008
Posts: 116
hi all,
i get this error when trying to parse a string :

java.lang.NumberFormatException: For input string: "12345501297"




i dont see why it throws this error ??

thanks in advance.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

The value you are trying to parse is too large for "int" type. Check with "Integer.MAX_VALUE".


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
chandrakant karale
Ranch Hand

Joined: Nov 21, 2007
Posts: 41


If you are dealing with large account numbers, use long as datatype; replace Integer.parseInt by Long.parseLong.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19653
    
  18

And if they still don't fit you have little option but to use BigInteger.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
wood burning stoves
 
subject: java.lang.NumberFormatException
 
Similar Threads
javax.servlet.jsp.JspException in Application
parseInt throwing exception
Session in jsp
Lost, need help
loading an integer data file into an integer array