public static String encodeZeroPadding(long number, int maxNumDigits) {
        String longString = Long.toString(number);
        int numZeroes = maxNumDigits - longString.length();
        StringBuffer strBuffer = new StringBuffer(numZeroes + longString.length());
        for (int i = 0; i < numZeroes; i++) {
            strBuffer.insert(i, '0');
        }
        strBuffer.append(longString);
        return strBuffer.toString();
    }
public static String encodeZeroPadding ( long number , int maxNumDigits ) { String longString = Long . toString ( number ) ; int numZeroes = maxNumDigits - longString . length ( ) ; StringBuffer strBuffer = new StringBuffer ( numZeroes + longString . length ( ) ) ; for ( int i = 0 ; i < numZeroes ; i ++ ) { strBuffer . insert ( i , '0' ) ; } strBuffer . append ( longString ) ; return strBuffer . toString ( ) ; }
Encodes positive long value into a string by zero-padding the value up to the specified
number of digits.

@param number
positive long to be encoded
@param maxNumDigits
maximum number of digits in the largest value in the data set
@return string representation of the zero-padded long