Dear friends, This code is giving me NumberFormatException. I want to convert that String value to a Long/long data type. long a = Long.parseLong(str) also gives me NumberFormatException.
Kindly help me out to solve this problem. Regards, Vijay
The number looks suspiciously like its a larger value than a long can hold. Have a look at BigInteger. [ October 23, 2007: Message edited by: Paul Sturrock ]
A long can only store numbers up to 9223372036854775807. Your number is larger than that, so it won't fit in a long. That's the reason of the exception.
Compare: 9223372036854775807 vs 12121211193148935244
You'll need either a float or double, or java.math.BigInteger.