double number = 12345.6789; // you have this
int decimal = (int) number; // you have 12345
double fractional = number - decimal // you have 0.6789
The problem here is that the fractional part is not written in memory as "0.6789", but may have certain "offsets", so to say. For example 0.6789
can be stored as 0.67889999291293929991
.
I think your main concern here isn't getting the fractional part, but getting the fractional part with a certain precision.
If you'd like to get the exact values you assigned it to, you may want to consider this (altho, it's not a clean solution):
String doubleAsText = "12345.6789";
double number = Double.parseDouble(doubleAsText);
int decimal = Integer.parseInt(doubleAsText.split("\.")[0]);
int fractional = Integer.parseInt(doubleAsText.split("\.")[1]);
But, as I said, this is not the most efficient and cleanest solution.