I have these two variables
double num = 540.512 double sum = 1978.8
Then I did this expression
double total = Math.round((
Helpful method I created a while ago...
private static double round (double value, int precision) { int scale = (int) Math.pow(10, precision); return (double) Math.round(value * scale) / scale; }