I have tried to separate 5.6 (for example) by the following method:
private static double[] method(double d)
{
int integerPart = 0;
double fractionPart =
Use BigDecimal to do that same calculation. (using doubles has precision problems because of its representation).
new BigDecimal(String.valueOf(yourDouble))
(this is still going through string, but the parts are not separated via string manipulation)bd.subtract(new BigDecimal(bd.intValue())
to determine the fraction