java.lang.NumberFormatException: 1000000000099 ihave a number 1000000000099 and im wanting to do parse in /parse long but im getting number format exception why??? please help
/* try this code... 1. if u have 1000000000099 as a String object, change it to Lang object and then to long 2. if u have 1000000000099 as a Long object chage it to long --- see java.Lang package for details --- */ class help1 { public static void main(String[] args) { String S="1000000000099"; /* trim() to remove extra spaces from the strng value */ Long L=new Long(S.trim()); long l=L.longValue(); System.out.println("S is "+S); System.out.println("L is "+L); System.out.println("l is "+l); } } regards ramakrishna
Originally posted by sriramakrishna besta: 1. if u have 1000000000099 as a String object, change it to Lang object and then to long 2. if u have 1000000000099 as a Long object chage it to long
In actual fact, the constructor for Long(String) uses Long.parseLong(String) to convert the string into a long first! Creating a Long object just to parse a string is a waste of perfectly good CPU cycles; Long.parseLong() should do the job. Without more information it's difficult to say what's wrong. - Peter
[This message has been edited by Peter den Haan (edited October 03, 2001).]
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.