class StringBuilderUtil {

    public static void format2f(@NonNull StringBuilder sb, float x) {
        final int x100 = Math.round(x * 100);
        final int whole = x100 / 100;
        final int tenths = x100 / 10 % 10;
        final int hundredths = x100 % 10;
        sb.append(whole);
        sb.append(".");
        sb.append(tenths);
        sb.append(hundredths);
    }

}

class StringBuilderUtilTest {

    private final double[] testDoubles;
    private final float[] testFloats;
    private final long[] testLongs;

    @Test
    public void format2f() {

        StringBuilder sb = new StringBuilder();

        for (float value : testFloats) {
            sb.setLength(0);
            StringBuilderUtil.format2f(sb, value);
            assertEquals(String.format("%.2f", value), sb.toString());
        }
    }

}