FormatUtil { public static String formatDoubleToString(double d) { if(d == (long) d) return String.format("%d",(long)d); else return String.format("%s",d); }  static String formatDoubleToString(double d); static String removeUnwantedCharacters(String content);  }
@Test public void testFormatDouble() { assertEquals("123", FormatUtil.formatDoubleToString(123.000)); assertEquals("123", FormatUtil.formatDoubleToString(123)); assertEquals("123.1", FormatUtil.formatDoubleToString(123.100)); assertEquals("123.12", FormatUtil.formatDoubleToString(123.1200)); assertEquals("123.123", FormatUtil.formatDoubleToString(123.123)); assertEquals("-123", FormatUtil.formatDoubleToString(-123)); assertEquals("-123.1", FormatUtil.formatDoubleToString(-123.100000)); }