Convert Float to String in Java with N Decimal Places
Convert a float to a String in Java with Float.toString() or String.valueOf(), and format it to 2 or N decimal places with String.format() or DecimalFormat. Learn the rounding rules, the locale trap and why 2.675f becomes 2.67.
