while this is an interesting way to do rounding, it's a *tad* inefficient.
It's as if you're reinventing the wheel by making one the size of a house. If
you want to round just use DecimalFormat:
import java.text.DecimalFormat;
public class Rounding {
public static void main(String[] args) {
DecimalFormat df = new DecimalFormat("#.00");
double d = 3.12345678901;
System.out.println(df.format(d));
}
}