If you're having rounding issues within the math of your program, I've been there. This line works like a charm.
x = Math.round(x * 100.0) / 100.0;
That being said, if you only want the answer to be rounded at the end (aka the output) just use SYstem.out.printf("%2f", x); like these guys suggested