The way you initialize BigDecimal is strange for me....
I guess you should initialize first an Instance of it before you use valueOf(something) method....
But it may be simplified....
According to your string sample, that value may not be applicable to long, see what's the maximum value can long datatype handles...
You may also try Double,
eg.
String c = "848595950484765868574748349586738596879";
try {
BigDecimal num2 = new BigDecimal(new Double(c));
System.out.println(num2);
} catch (NumberFormatException nfe) {
nfe.printStackTrace();
}
__________________
A specific, detailed, simple, well elaborated, and "tested before asking" question may gather more quick replies. hopefully To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Last edited by sukatoa : 06-07-2008 at 03:52 PM.
Reason: Typo
|