public static char[] encode(byte[] bites, int startIndex, int length) {
        char[] result = new char[length * 2];
        for (int i = 0, j = 0; i < length; i++) {
            int bite = bites[startIndex++] & 0xff;
            result[j++] = HEX_CHARS[bite >> 4];
            result[j++] = HEX_CHARS[bite & 0xf];
        }
        return result;
    }
Hex encode an array of bytes

@param bites      the array of bytes to encode.
@param startIndex the index of the first character to encode.
@param length     the number of characters to encode.
@return the array of hex characters.
tika-core/src/main/java/org/apache/tika/mime/HexCoDec.java