protected static String timestr(long time_val,long total_time){
  boolean neg;
  long ms=0;
  long sec=0;
  long percent10;
  String pad;
  neg=time_val < 0;
  if (neg)   time_val=-time_val;
  ms=time_val % 1000;
  sec=time_val / 1000;
  if (sec < 10)   pad="   ";
 else   if (sec < 100)   pad="  ";
 else   if (sec < 1000)   pad=" ";
 else   pad="";
  percent10=(time_val * 1000) / total_time;
  return (neg ? "-" : "") + pad + sec+ "."+ ((ms % 1000) / 100)+ ((ms % 100) / 10)+ (ms % 10)+ "sec"+ " ("+ percent10 / 10 + "." + percent10 % 10 + "%)";
}

protected static String timestr ( long time_val , long total_time ) { boolean neg ; long ms = 0 ; long sec = 0 ; long percent10 ; String pad ; neg = time_val < 0 ; if ( neg ) time_val = - time_val ; ms = time_val % 1000 ; sec = time_val / 1000 ; if ( sec < 10 ) pad = "   " ; else if ( sec < 100 ) pad = "  " ; else if ( sec < 1000 ) pad = " " ; else pad = "" ; percent10 = ( time_val * 1000 ) / total_time ; return ( neg ? "-" : "" ) + pad + sec + "." + ( ( ms % 1000 ) / 100 ) + ( ( ms % 100 ) / 10 ) + ( ms % 10 ) + "sec" + " (" + percent10 / 10 + "." + percent10 % 10 + "%)" ; }
helper routine to format a decimal based display of seconds and percentage of total time given counts of milliseconds . note : this is broken for use with some instances of negative time ( since we don ' t use any negative time here , we let if be for now ) .
