### Question:
DateTimeUtilities { public static String fixMillis(String dateTimeString) { String fixedString = dateTimeString; Matcher matcher = TOO_MANY_MILLIS_PATTERN.matcher(dateTimeString); if (matcher.matches()) { String match = matcher.group(1); int millis = Integer.parseInt(match.substring(1, 5)); millis = Math.round((float)millis / 10); String replacement = new StringBuilder(4).append('.').append(millis).toString(); fixedString = Pattern.compile(match, Pattern.LITERAL).matcher(dateTimeString).replaceFirst(replacement); } return fixedString; } private  DateTimeUtilities(); static String fixMillis(String dateTimeString); static String generateISO8601DateString(Date date); static Date parse(DateFormat dateFormat, String source); static Date parseISO8601Date(String dateStr);  }### Answer:
@Test public void testFixMillis() throws ParseException { Assert.assertEquals("12:13:14.543", DateTimeUtilities.fixMillis("12:13:14.543")); Assert.assertEquals("12:13:14.543", DateTimeUtilities.fixMillis("12:13:14.5432")); Assert.assertEquals("12:13:14.988", DateTimeUtilities.fixMillis("12:13:14.9876")); Assert.assertEquals("12:13:14.988Z", DateTimeUtilities.fixMillis("12:13:14.9876Z")); Assert.assertEquals("a.123 b.568 c", DateTimeUtilities.fixMillis("a.123 b.56789 c")); Assert.assertEquals("12:13:2014", DateTimeUtilities.fixMillis("12:13:2014")); }