StringBuilderUtil { public static void format3d(@NonNull StringBuilder sb, long x) { if (x < 10) { sb.append("00"); } else if (x < 100) { sb.append('0'); } sb.append(x); }  static void format2f(@NonNull StringBuilder sb, float x); static void format3f(@NonNull StringBuilder sb, double x); static void format2d(@NonNull StringBuilder sb, long x); static void format3d(@NonNull StringBuilder sb, long x);  }
@Test public void format3d() { StringBuilder sb = new StringBuilder(); for (long value : testLongs) { sb.setLength(0); StringBuilderUtil.format3d(sb, value); assertEquals(String.format("%03d", value), sb.toString()); } }