StringUtils { public static String removeZeroDecimal(final String str) { if (Strings.isNullOrEmpty(str)) { return str; } return ZERO_DECIMAL_PATTERN.matcher(str).replaceFirst(EMPTY); } private  StringUtils(); static String[] splitByCharacterTypeCamelCase(final String str); static String join(final Object[] array, final char separator); static String repeat(final String str, final int repeat); static int length(final CharSequence cs); static String capitalize(final String str); static boolean isAlpha(final String cs); static boolean isAlphanumeric(final String cs); static boolean isNumeric(final String cs); static boolean isAllLowerCase(final String cs); static boolean isAllUpperCase(final String cs); static String removeZeroDecimal(final String str); static String abbreviate(final String str, final String abbrevMarker, final int maxWidth);  }
@Test public void testRemoveZeroDecimal() { assertEquals("246", StringUtils.removeZeroDecimal("246.0")); assertEquals("146", StringUtils.removeZeroDecimal("146.00")); assertEquals("357", StringUtils.removeZeroDecimal("357.000")); assertEquals("347", StringUtils.removeZeroDecimal("347.0000")); assertEquals("468", StringUtils.removeZeroDecimal("468")); assertEquals("24", StringUtils.removeZeroDecimal("24")); assertEquals("468.02", StringUtils.removeZeroDecimal("468.02")); assertEquals("246.004", StringUtils.removeZeroDecimal("246.004")); assertEquals("246.4000", StringUtils.removeZeroDecimal("246.4000")); assertEquals("", StringUtils.removeZeroDecimal("")); assertNull(StringUtils.removeZeroDecimal(null)); }