public static String toLZ( int i, int len ) { // converts integer to left-zero padded string, len chars long. String s = Integer.toString(i); if ( s.length() > len ) return s.substring(0,len); else if ( s.length() < len ) // pad on left with zeros return "000000000000000000000000000".substring(0, len - s.length ()) + s; else return s; } // end toLZ