View Single Post
  #3 (permalink)  
Old 06-07-2008, 04:49 PM
sukatoa's Avatar
sukatoa sukatoa is offline
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 527
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
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.

Code:
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 04:52 PM. Reason: Typo
Reply With Quote