LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-14-2008, 02:28 AM   #1
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 464

Rep: Reputation: 37
Java NumberFormatException with a valid number/string


Hi there,

I have a method like the following:

Quote:
public long getAsLong(String number)
{
return new Long(number).longValue();
}
My problem is that I get an exception such as the following:

Quote:
java.lang.FormatException For input string: "1223242177912"
As you can see the string that is parsed is indeed a valid long number. Does anybody know why it results to a problem. Any ideas how to overcome it?

Thank you.
 
Old 12-14-2008, 04:59 AM   #2
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
This works for me. Is that error pasted without any editing? What JVM and version are you using? What is the code that calls getAsLong?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP function to check if string is valid xml? j-ray Programming 6 12-19-2009 07:46 AM
OSD 10.3 + Nvidia + Compiz = No valid GL extensions string found. gopher91 Linux - Desktop 1 01-03-2008 02:18 PM
Counting number of occurences of a certain chacter in string java linuxmandrake Programming 4 04-27-2006 11:10 PM
Regular expression to match a valid URL string vharishankar Programming 13 07-21-2005 09:17 PM
java test if string in string array is null. exodist Programming 3 02-21-2004 01:39 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration