Decimal (fraction) number manipulation

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?

[464 byte] By [cno-81a] at [2007-10-3 4:28:55]
# 1
Don't need no steenking method calls.long nanos = millis * 1000000;int rawmillis = nanos / 1000000;int rawnanos = nanos % 1000000;
DrClapa at 2007-7-14 22:31:55 > top of Java-index,Java Essentials,Java Programming...
# 2
For ms cast the floating pt num to an int (this takes off the decimal)ms = (int) numFor the nano(int) ( decimal * (10 ^ number of digits in decimal) )
TuringPesta at 2007-7-14 22:31:55 > top of Java-index,Java Essentials,Java Programming...
# 3
Thanks guys. Amazing how you can get lost in your own code/problems, just needed a fresh perspective on things! Dunno why I didnt think of that, oh well :/ Cheers again.
cno-81a at 2007-7-14 22:31:55 > top of Java-index,Java Essentials,Java Programming...