public static long readLong(InputStream input, int width) throws SerializationException {
        if (width > 8 || width < 0) {
            throw new IllegalArgumentException("Invalid width: " + width);
        }

        long result = 0;
        for (int i = 0; i < width; i++) {
            result = (result << 8) | (readByte(input) & 0xFF);
        }

        return result;
    }
Read a number in big endian format from the input stream.
This methods supports a width of up to 8 bytes.
@param width the width of the number, in bytes.
@throws SerializationException if EOF is encountered.
@throws IllegalArgumentException if {@code width} is negative or greater than 8
common/src/main/java/org/conscrypt/ct/Serialization.java