Besides the rounding problem, note that
you should not expect a
float or
double to be able to hold numbers of arbitrary precision. A float has about 6 decimal digits of precision, and a double about 15 digits. Floats and doubles are stored as binary fractions and they can't represent some decimal numbers to exact precision; for example the number 0.1 cannot be stored in a float or double exactly. Some calculations will inevitably lead to rounding errors.
The API documentation of DecimalFormat says:
DecimalFormat provides rounding modes defined in RoundingMode for formatting. By default, it uses RoundingMode.HALF_EVEN.