How to extract fractional digits of double/BigDecimal

Viewed 61695

Say we have a double value of 12345.6789 (should be dynamic)

Now the requirement is split the number and get the decimal digits and fractional digits, which would be:

double number = 12345.6789;
int decimal = 12345;
int fractional = 6789;

I get the decimal part work out but could you please give a hint on the fractional part? Thanks a lot.

4 Answers
Related