public static String padWithMax(final int numToPad, final int maxValue) {
    checkArgument(numToPad >= 0);
    checkArgument(numToPad <= maxValue);
    final int maxLength = Integer.toString(maxValue).length();
    final String baseString = Integer.toString(numToPad);
    final String padding = Strings.repeat("0", maxLength - baseString.length());
    return padding + numToPad;
  }
public static String padWithMax ( final int numToPad , final int maxValue ) { checkArgument ( numToPad >= 0 ) ; checkArgument ( numToPad <= maxValue ) ; final int maxLength = Integer . toString ( maxValue ) . length ( ) ; final String baseString = Integer . toString ( numToPad ) ; final String padding = Strings . repeat ( "0" , maxLength - baseString . length ( ) ) ; return padding + numToPad ; }
Produces a string representation of a positive integer padded with leading zeros. Enough zeros
are adding so that the supplied {@code maxValue} would have the same number of digits.