private static double round (double value, int precision) {
int scale = (int) Math.pow(10, precision);
return (double) Math.round(value * scale) / scale;
}
I would like this code to not only be able to round to any given decimal place, but also to either always round up or down, this could be given as another paramter. But I am having trouble with how to implement this.
For example, I want to round 11.1436 to 11.15. Please help.