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.
968829
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;
  }
946001
function paddingNumber(num, radix, digits, upperCase, paddingChar, sign, align) {
  let str = num.toString(radix);
  if (upperCase) {
    str = str.toUpperCase();
  }
  if (digits === 0) {
    return str;
  }

  if (sign === "plus" && num >= 0) {
    str = `+${str}`;
  } else if (sign === "space" && num >= 0) {
    str = ` ${str}`;
  }

  let len = str.length;
  let result = "";
  while ((digits - len++) > 0) {
    result += paddingChar;
  }

  if (align === "left") {
    result = str + result;
  } else {
    result += str;
  }

  if (align === "right_lead_sign") {
    result = result.replace(/.(.*)([-+ ])(.+)/i, `$2$1${paddingChar}$3`);
  }

  return result;
}
540547
def paddedInt(i):
    '''
    
    '''
    i_str = str(i)
    pad = PAD_LEN - len(i_str)
    return (pad * "0") + i_str
21743
def _num_to_string(self, number, pad_to_length=None):
        
        output = ""
        while number:
            number, digit = divmod(number, self._alpha_len)
            output += self._alphabet[digit]
        if pad_to_length:
            remainder = max(pad_to_length - len(output), 0)
            output = output + self._alphabet[0] * remainder
        return output
1095608
def _format_finite(negative, digits, dot_pos):
    """"""

    # strip leading zeros
    olddigits = digits
    digits = digits.lstrip('0')
    dot_pos -= len(olddigits) - len(digits)

    # value is 0.digits * 10**dot_pos
    use_exponent = dot_pos <= -4 or dot_pos > len(digits)
    if use_exponent:
        exp = dot_pos - 1 if digits else dot_pos
        dot_pos -= exp

    # left pad with zeros, insert decimal point, and add exponent
    if dot_pos <= 0:
        digits = '0' * (1 - dot_pos) + digits
        dot_pos += 1 - dot_pos
    assert 1 <= dot_pos <= len(digits)
    if dot_pos < len(digits):
        digits = digits[:dot_pos] + '.' + digits[dot_pos:]
    if use_exponent:
        digits += "e{0:+03d}".format(exp)
    return '-' + digits if negative else digits
1223553
@SuppressWarnings("empty-statement")
    public static String decodeIntegerToString(BigInteger num) {
        byte[] bytes = num.toByteArray();
        int count;
        for (count = 0; count < bytes.length && bytes[count] == 0; count++);
        byte[] trimmed = new byte[bytes.length - count];
        System.arraycopy(bytes, count, trimmed, 0, trimmed.length);
        return new String(trimmed, StandardCharsets.UTF_8);
    }
40333
public static String validate(String value, int min, int max) {
        if (min == max) {
            return validate(value, min);
        }
        if ((value.length() < min) || (value.length() > max)) {
            throw new InvalidLengthException(value, min, max);
        }
        return value;
    }
196220
public FormatStringBuffer format(long l) {

        Format fmt = getFormat();

        if (fmt.type != DECIMAL) throw new IllegalArgumentException("Expected a float format");

        // Decide padding character.
        char pad = ' ';
        if ((fmt.flags & ZEROPAD) == ZEROPAD) {
            pad = '0';
        }

        // Convert number to String.
        String str;
        String prefix = "";
        switch (fmt.base) {
            case 8:
                str = Long.toOctalString(l);
                if ((fmt.flags & SPECIAL) == SPECIAL) {
                    fmt.fieldWidth -= 1;
                    prefix = "0";
                }
                break;
            case 16:
                str = Long.toHexString(l);
                if ((fmt.flags & SPECIAL) == SPECIAL) {
                    fmt.fieldWidth -= 2;
                    prefix = "0x";
                }
                break;
            default:
                str = String.valueOf(Math.abs(l));
                break;
        }

        if ((fmt.flags & LARGE) == LARGE) {
            str = str.toUpperCase();
            prefix = prefix.toUpperCase();
        }

        int len = str.length();

        if (l < 0 || (fmt.flags & PLUS) == PLUS) {
            fmt.fieldWidth--;
        }

        // Place the sign character first if zero padding.
        if ((fmt.flags & ZEROPAD) == ZEROPAD) {
            if (l < 0 && fmt.base == 10) {
                buffer.append('-');
            } else if ((fmt.flags & PLUS) == PLUS && fmt.base == 10) {
                buffer.append('+');
            }
            buffer.append(prefix);
        }

        // Pad.
        if ((fmt.flags & LEFT) != LEFT) while (len < fmt.fieldWidth--)
            buffer.append(pad);

        // Place the sign character now if not zero padding.
        if ((fmt.flags & ZEROPAD) != ZEROPAD) {
            if (l < 0 && fmt.base == 10) {
                buffer.append('-');
            } else if ((fmt.flags & PLUS) == PLUS && fmt.base == 10) {
                buffer.append('+');
            }
            buffer.append(prefix);
        }

        for (int i = 0; i < len; ++i)
            buffer.append(str.charAt(i));

        while (len < fmt.fieldWidth--)
            buffer.append(' ');

        return this;
    }
510371
public Bits writeBoundedLong(final long value, final long max)
    throws IOException {
    final int bits = 0 >= max ? 0 : (int) (Math
      .floor(Math.log(max) / Math.log(2)) + 1);
    if (0 < bits) {
      Bits toWrite = new Bits(value, bits);
      this.write(toWrite);
      return toWrite;
    }
    else {
      return Bits.NULL;
    }
  }
213227
private String LPad(String inStr, int maxLen) {
        if (inStr.length() >= maxLen) return inStr.toUpperCase();
        String zeroes = PADCHARS.substring(0, maxLen - inStr.length());
        String retVal = zeroes + inStr;
        return retVal.toUpperCase();
    }
450979
public static String checkLeadingZeros(String generated, boolean paddingOn) {
        if (paddingOn) {
            return replaceLeadingZero(generated);
        } else {
            return removeLeadingZeros(generated);
        }
        
    }
1096487
public Optional<Integer> getMaxlength() {
        if (property instanceof StringProperty) {
            StringProperty stringProperty = (StringProperty) property;
            return Optional.ofNullable(stringProperty.getMaxLength());
        } else if (property instanceof UUIDProperty) {
            UUIDProperty uuidProperty = (UUIDProperty) property;
            return Optional.ofNullable(uuidProperty.getMaxLength());
        }
        return Optional.empty();
    }
224373
static String toHexString(final byte b) {
		String hexString = Integer.toHexString(b & 0xFF);
		if (hexString.length() % 2 != 0) {
			// Pad with 0
			hexString = "0" + hexString;
		}
		return hexString;
	}
860538
public static int parseInt(String s, int i, int min, int max) {
		return minMax(min, parseInt(s, i), max);
	}
1251572
static String byteToBinaryString(byte b, int limit) {
    final StringBuilder sb = new StringBuilder();
    if (limit > 8) {
      limit = 8;
    }
    for (int i = 0; i < limit; i++) {
      sb.append((char)('0' + (b&1)));
      b>>=1;
    }
    return sb.toString();
  }
278570
static String toUnsignedString(long l) {
    BigInteger b = BigInteger.valueOf(l);
    if (b.signum() < 0) {
      b = b.add(TWO_64);
    }
    return b.toString();
  }
228624
public static long parsePositiveLong(String str) {
        long value = 0;
        final int length = str.length();

        if (length == 0) {
            throw new NumberFormatException(str);
        }

        long multiplier = 1;
        for (int i = length - 1; i >= 0; --i) {
            char c = str.charAt(i);

            if (c < '0' || c > '9') {
                throw new NumberFormatException(str);
            }
            long digit = c - '0';
            value += digit * multiplier;
            multiplier *= 10;
        }
        return value;
    }