Time { public static long parseTime(String s) { s = s.toLowerCase(); if (s.endsWith("ms")) { return Long.parseLong(s.substring(0, s.length() - 2)); } if (s.endsWith("s")) { return Long.parseLong(s.substring(0, s.length() - 1)) * 1000; } if (s.endsWith("m")) { return Long.parseLong(s.substring(0, s.length() - 1)) * 60000; } return Long.parseLong(s); }  static String formatTime(long time); static long parseTime(String s);  }
@Test public void testParseSeconds() { assertEquals(1000, Time.parseTime("1s")); assertEquals(1000, Time.parseTime("1S")); }
@Test public void testParseMillis() { assertEquals(1, Time.parseTime("1ms")); }
@Test public void testParse() { assertEquals(1, Time.parseTime("1")); }
@Test public void testParseMinutes() { assertEquals(60000, Time.parseTime("1m")); }