class StringBuilderUtil {

    public static void format3f(@NonNull StringBuilder sb, double x) {
        final long x1000 = Math.round(x * 1000);
        final long whole = x1000 / 1000;
        final long tenths = x1000 / 100 % 10;
        final long hundredths = x1000 / 10 % 10;
        final long thousandths = x1000 % 10;
        sb.append(whole);
        sb.append(".");
        sb.append(tenths);
        sb.append(hundredths);
        sb.append(thousandths);
    }

}