private static void encodeAndAppend(int value, Appendable buf, int numChars) {
        for (int i = 0; i < numChars; i++) {
            append(buf, itoa64[value & 0x3f]);
            value >>= 6;
        }
    }
Encodes the specified integer to {@code numChars} H64-compatible characters and appends them into {@code buf}.

@param value    the integer to encode to H64-compatible characters
@param buf      the output buffer
@param numChars the number of characters the value should be converted to.  3, 2 or 1.
src/main/java/org/apache/shiro/lang/codec/H64.java