public static String formatElapsedTime(long time){
  if (time < 0) {
    return "-";
  }
  long hours=0;
  long minutes=0;
  long seconds=0;
  long elapsedSeconds=(long)(time * UnitConversions.MS_TO_S);
  if (elapsedSeconds >= 3600) {
    hours=elapsedSeconds / 3600;
    elapsedSeconds-=hours * 3600;
  }
  if (elapsedSeconds >= 60) {
    minutes=elapsedSeconds / 60;
    elapsedSeconds-=minutes * 60;
  }
  seconds=elapsedSeconds;
  if (hours > 0) {
    return String.format(Locale.US,"%d:%02d:%02d",hours,minutes,seconds);
  }
 else {
    return String.format(Locale.US,"%02d:%02d",minutes,seconds);
  }
}

public static String formatElapsedTime ( long time ) { if ( time < 0 ) { return "-" ; } long hours = 0 ; long minutes = 0 ; long seconds = 0 ; long elapsedSeconds = ( long ) ( time * UnitConversions . MS_TO_S ) ; if ( elapsedSeconds >= 3600 ) { hours = elapsedSeconds / 3600 ; elapsedSeconds -= hours * 3600 ; } if ( elapsedSeconds >= 60 ) { minutes = elapsedSeconds / 60 ; elapsedSeconds -= minutes * 60 ; } seconds = elapsedSeconds ; if ( hours > 0 ) { return String . format ( Locale . US , "%d:%02d:%02d" , hours , minutes , seconds ) ; } else { return String . format ( Locale . US , "%02d:%02d" , minutes , seconds ) ; } }
formats the elapsed timed in the form " mm : ss " or " h : mm : ss " .
