@Test public void format2() { NumberFormat f = NumberFormats.format(3); assertThat(f.format(1234.4567), equalTo("1234.457")); assertThat(f.format(123), equalTo("123.000")); assertThat(f.format(123.4), equalTo("123.400")); f = NumberFormats.format(0); assertThat(f.format(1234.4567), equalTo("1234")); assertThat(f.format(123), equalTo("123")); assertThat(f.format(123.4), equalTo("123")); f = NumberFormats.format(4); assertThat(f.format(1234.4567), equalTo("1234.4567")); assertThat(f.format(123), equalTo("123.0000")); assertThat(f.format(123.4), equalTo("123.4000")); }
public static NumberFormat format(int precision) { NumberFormat format = precisionFormat.get(precision); if (format == null) { precisionFormat.put(precision, createFormatter(precision)); } return precisionFormat.get(precision); }
NumberFormats { public static NumberFormat format(int precision) { NumberFormat format = precisionFormat.get(precision); if (format == null) { precisionFormat.put(precision, createFormatter(precision)); } return precisionFormat.get(precision); } }
NumberFormats { public static NumberFormat format(int precision) { NumberFormat format = precisionFormat.get(precision); if (format == null) { precisionFormat.put(precision, createFormatter(precision)); } return precisionFormat.get(precision); } private  NumberFormats(); }
NumberFormats { public static NumberFormat format(int precision) { NumberFormat format = precisionFormat.get(precision); if (format == null) { precisionFormat.put(precision, createFormatter(precision)); } return precisionFormat.get(precision); } private  NumberFormats(); static NumberFormat format(int precision); static NumberFormat toStringFormat(); }
NumberFormats { public static NumberFormat format(int precision) { NumberFormat format = precisionFormat.get(precision); if (format == null) { precisionFormat.put(precision, createFormatter(precision)); } return precisionFormat.get(precision); } private  NumberFormats(); static NumberFormat format(int precision); static NumberFormat toStringFormat();  }