For rounding, use the Math.round() method. It only rounds to a whole number, so multiply by 100d and round and divide by 100d. To print out 12.3400 use the methods which use % tags, eg printf or format. Details in the Formatter class.
posted 10 years ago
By the way, you are not using the same rounding convention as in Math.round(). For round-toward-zero, multiply by 100, cast to an int or long and divide by 100d.
I will suppress my every urge. But not this shameless plug: