Computing.Net > Forums > Programming > java - parseInt

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

java - parseInt

Reply to Message Icon

Name: cesar_NZ
Date: October 28, 2008 at 15:43:52 Pacific
OS: solaris
CPU/Ram: na
Product: na
Comment:

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 ?? what other way can i use to convert it back to int ?

code: java.lang.Integer.parseInt(str);


thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: Jimmytherifle
Date: October 29, 2008 at 08:31:58 Pacific
Reply:

http://java.sun.com/j2se/1.5.0/docs...

If I'm correct, I think Java ints can go as high as (2^31)-1. As a side note as well, I think you can omit the "java.lang." in your code. From what I've seen java.lang is a default package and is automatically imported by most compilers.


0

Response Number 2
Name: klint
Date: October 30, 2008 at 06:48:06 Pacific
Reply:

Are you really going to use such a big number as an integer? What is the purpose? Perhaps the java.math.BigInteger class can help.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: java - parseInt

Java: need help www.computing.net/answers/programming/java-need-help-/7802.html

Java I/O Help www.computing.net/answers/programming/java-io-help/12986.html

Java need code: hex to Ascii www.computing.net/answers/programming/java-need-code-hex-to-ascii/3727.html