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 =
As RGO stated, you can do that and also round the decimal number in order to get the appropriate value. Ex:
double number = 20.57;
int integer = (int)number;
double decimal = (10 * number - 10 * integer)/10;
double temp = Math.round(decimal*100.0)/100.0;
System.out.println("Int = " + integer + "\nDecimal = " + temp);