public static String defaultTimeString(int value,int digits){
  String valueAsString=String.valueOf(value);
  String result="";
  if (valueAsString.length() > digits) {
    for (int i=0; i < digits; i++) {
      result+=valueAsString.charAt(i);
    }
  }
 else   if (valueAsString.length() < digits) {
    result=valueAsString;
    while (result.length() < digits) {
      result="0" + result;
    }
  }
 else {
    result=valueAsString;
  }
  return result;
}

public static String defaultTimeString ( int value , int digits ) { String valueAsString = String . valueOf ( value ) ; String result = "" ; if ( valueAsString . length ( ) > digits ) { for ( int i = 0 ; i < digits ; i ++ ) { result += valueAsString . charAt ( i ) ; } } else if ( valueAsString . length ( ) < digits ) { result = valueAsString ; while ( result . length ( ) < digits ) { result = "0" + result ; } } else { result = valueAsString ; } return result ; }
expresses value in terms of digits . if value is 0 and digits is 2 " 00 " will be returned . if value is 1 and digits is 2 " 01 " is returned . if value is 123 and digits is 2 then " 12 " is returned .
