public static int toUInt16(final byte[] bytes, final int offset, final ByteOrder byteOrder) {
        final int byte0 = 0xff & bytes[offset + 0];
        final int byte1 = 0xff & bytes[offset + 1];
        if (byteOrder == ByteOrder.BIG_ENDIAN) {
            return byte0 << 8 | byte1;
        }
        return byte1 << 8 | byte0;
    }
Interprets the content of a specified bytes array to create an instance of the RationalNumber class.

@param bytes        a valid array dimensioned to at least 8.
@param byteOrder    the byte order for integer conversion
@param unsignedType indicates whether the extracted value is an unsigned type.
@return a valid instance
src/main/java/org/apache/commons/imaging/common/ByteConversions.java