@Test public void testSecondDurationInMillis() { long duration = DurationParser.inMillis("00:45"); assertEquals(45 * seconds, duration); }
public static long inMillis(String durationStr) throws NumberFormatException { String[] parts = durationStr.trim().split(":"); if (parts.length == 1) { return toMillis(parts[0]); } else if (parts.length == 2) { return toMillis("0", parts[0], parts[1]); } else if (parts.length == 3) { return toMillis(parts[0], parts[1], parts[2]); } else { throw new NumberFormatException(); } }
DurationParser { public static long inMillis(String durationStr) throws NumberFormatException { String[] parts = durationStr.trim().split(":"); if (parts.length == 1) { return toMillis(parts[0]); } else if (parts.length == 2) { return toMillis("0", parts[0], parts[1]); } else if (parts.length == 3) { return toMillis(parts[0], parts[1], parts[2]); } else { throw new NumberFormatException(); } } }
DurationParser { public static long inMillis(String durationStr) throws NumberFormatException { String[] parts = durationStr.trim().split(":"); if (parts.length == 1) { return toMillis(parts[0]); } else if (parts.length == 2) { return toMillis("0", parts[0], parts[1]); } else if (parts.length == 3) { return toMillis(parts[0], parts[1], parts[2]); } else { throw new NumberFormatException(); } }  }
DurationParser { public static long inMillis(String durationStr) throws NumberFormatException { String[] parts = durationStr.trim().split(":"); if (parts.length == 1) { return toMillis(parts[0]); } else if (parts.length == 2) { return toMillis("0", parts[0], parts[1]); } else if (parts.length == 3) { return toMillis(parts[0], parts[1], parts[2]); } else { throw new NumberFormatException(); } }  static long inMillis(String durationStr); }
DurationParser { public static long inMillis(String durationStr) throws NumberFormatException { String[] parts = durationStr.trim().split(":"); if (parts.length == 1) { return toMillis(parts[0]); } else if (parts.length == 2) { return toMillis("0", parts[0], parts[1]); } else if (parts.length == 3) { return toMillis(parts[0], parts[1], parts[2]); } else { throw new NumberFormatException(); } }  static long inMillis(String durationStr);  }