public static String zeroPadString(String string, int length) {
        if (string == null || string.length() > length) {
            return string;
        }
        StringBuilder buf = new StringBuilder(length);
        buf.append(zeroArray, 0, length - string.length()).append(string);
        return buf.toString();
    }
Pads the supplied String with 0's to the specified length and returns
the result as a new String. For example, if the initial String is
"9999" and the desired length is 8, the result would be "00009999".
This type of padding is useful for creating numerical values that need
to be stored and sorted as character data. Note: the current
implementation of this method allows for a maximum {@code length} of
64.

@param string the original String to pad.
@param length the desired length of the new padded String.
@return a new String padded with the required number of 0's.
xmppserver/src/main/java/org/jivesoftware/util/StringUtils.java