### Question:
NumberFormats { public static NumberFormat toStringFormat() { return toStringFormat; } private  NumberFormats(); static NumberFormat format(int precision); static NumberFormat toStringFormat();  }### Answer:
@Test public void toStringFormat() { NumberFormat format = NumberFormats.toStringFormat(); assertThat(format.format(2.0), equalTo("2.0")); assertThat(format.format(Double.NaN), equalTo("NaN")); assertThat(format.format(Double.POSITIVE_INFINITY), equalTo("Infinity")); assertThat(format.format(Double.NEGATIVE_INFINITY), equalTo("-Infinity")); assertThat(NumberFormats.toStringFormat(), sameInstance(format)); }