@Test public void testPrettyDuration() throws Exception { assertEquals("0m 1s 0ms", PrettyDuration.prettyDuration(1000)); }
public static String prettyDuration(long milliseconds) { long minutes = TimeUnit.MILLISECONDS.toMinutes(milliseconds); milliseconds -= TimeUnit.MINUTES.toMillis(minutes); long seconds = TimeUnit.MILLISECONDS.toSeconds(milliseconds); milliseconds -= TimeUnit.SECONDS.toMillis(seconds); StringBuilder sb = new StringBuilder(); sb.append(minutes); sb.append("m "); sb.append(seconds); sb.append("s "); sb.append(milliseconds); sb.append("ms"); return (sb.toString()); }
PrettyDuration { public static String prettyDuration(long milliseconds) { long minutes = TimeUnit.MILLISECONDS.toMinutes(milliseconds); milliseconds -= TimeUnit.MINUTES.toMillis(minutes); long seconds = TimeUnit.MILLISECONDS.toSeconds(milliseconds); milliseconds -= TimeUnit.SECONDS.toMillis(seconds); StringBuilder sb = new StringBuilder(); sb.append(minutes); sb.append("m "); sb.append(seconds); sb.append("s "); sb.append(milliseconds); sb.append("ms"); return (sb.toString()); } }
PrettyDuration { public static String prettyDuration(long milliseconds) { long minutes = TimeUnit.MILLISECONDS.toMinutes(milliseconds); milliseconds -= TimeUnit.MINUTES.toMillis(minutes); long seconds = TimeUnit.MILLISECONDS.toSeconds(milliseconds); milliseconds -= TimeUnit.SECONDS.toMillis(seconds); StringBuilder sb = new StringBuilder(); sb.append(minutes); sb.append("m "); sb.append(seconds); sb.append("s "); sb.append(milliseconds); sb.append("ms"); return (sb.toString()); }  }
PrettyDuration { public static String prettyDuration(long milliseconds) { long minutes = TimeUnit.MILLISECONDS.toMinutes(milliseconds); milliseconds -= TimeUnit.MINUTES.toMillis(minutes); long seconds = TimeUnit.MILLISECONDS.toSeconds(milliseconds); milliseconds -= TimeUnit.SECONDS.toMillis(seconds); StringBuilder sb = new StringBuilder(); sb.append(minutes); sb.append("m "); sb.append(seconds); sb.append("s "); sb.append(milliseconds); sb.append("ms"); return (sb.toString()); }  static String prettyDuration(long milliseconds); }
PrettyDuration { public static String prettyDuration(long milliseconds) { long minutes = TimeUnit.MILLISECONDS.toMinutes(milliseconds); milliseconds -= TimeUnit.MINUTES.toMillis(minutes); long seconds = TimeUnit.MILLISECONDS.toSeconds(milliseconds); milliseconds -= TimeUnit.SECONDS.toMillis(seconds); StringBuilder sb = new StringBuilder(); sb.append(minutes); sb.append("m "); sb.append(seconds); sb.append("s "); sb.append(milliseconds); sb.append("ms"); return (sb.toString()); }  static String prettyDuration(long milliseconds);  }