Converter { public static int durationStringShortToMs(String input, boolean durationIsInHours) { String[] parts = input.split(":"); if (parts.length != 2) { return 0; } int modifier = durationIsInHours ? 60 : 1; return Integer.parseInt(parts[0]) * 60 * 1000 * modifier + Integer.parseInt(parts[1]) * 1000 * modifier; } private  Converter(); static String getDurationStringLong(int duration); static String getDurationStringShort(int duration, boolean durationIsInHours); static int durationStringLongToMs(String input); static int durationStringShortToMs(String input, boolean durationIsInHours); static String getDurationStringLocalized(Context context, long duration); static String shortLocalizedDuration(Context context, long time); static float getVolumeFromPercentage(int progress);  }
@Test public void testDurationStringShortToMs() { String input = "8:30"; assertEquals(30600000, Converter.durationStringShortToMs(input, true)); assertEquals(510000, Converter.durationStringShortToMs(input, false)); }