Example #1
0
 static public String toString( float fs[] ) {
   SB sb = new SB();
   sb.p('[');
   for( float f : fs )
     sb.p(f==Float.MAX_VALUE ? "max": (f==-Float.MAX_VALUE ? "min": Float.toString(f))).p(',');
   return sb.p(']').toString();
 }
  /**
   * Pretty-formatting for duration.
   *
   * @param ms Millisecond to format.
   * @return Formatted presentation.
   */
  private static String formatDuration(long ms) {
    assert ms >= 0;

    if (ms == 0) return "< 1 ms";

    SB sb = new SB();

    long dd = ms / 1440000; // 1440 mins = 60 mins * 24 hours

    if (dd > 0) sb.a(dd).a(dd == 1 ? " day " : " days ");

    ms %= 1440000;

    long hh = ms / 60000;

    if (hh > 0) sb.a(hh).a(hh == 1 ? " hour " : " hours ");

    long min = ms / 60000;

    if (min > 0) sb.a(min).a(min == 1 ? " min " : " mins ");

    ms %= 60000;

    if (ms > 0) sb.a(ms).a(" ms ");

    return sb.toString().trim();
  }