Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Decimal (fraction) number manipulation

807569Sep 7 2006 — edited Sep 7 2006
I want to convert the result of division to milliseconds and nanoseconds so for example;

45.0 / 8.0 = 5.625 converted to 5 ms 625000 ns
35.0 / 6.0 = 5.8333(recurring) converted to 5 ms 833333 ns

I've hacked together a terribly cumbersome solution that involves converting to a string, parsing then formatting. Surely there is a more elegant/higher performance solution involving a method call or two that I've missed in one of the APIs?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 5 2006
Added on Sep 7 2006
3 comments
156 views