I am trying to separate a double into the integer and decimal parts
So for example, the number 24.4 should be separated into 24 and 4.
int integer =
I figured out the way with little workaround and I am sure it works for all the cases.
The code says it all.
double number = input.nextDouble(); // 234.025
String s = Double.toString(number); // "234.025"
s = "0" + s.substring(s.indexOf(".")); //"0.025"
double decimal = Double.parseDouble(s);// 0.025
int num = (int)number; // 234
System.out.println(decimal + " " + num); //0.025 234