System.out.println("dirTagCount = " + dirTagCount);
    private void processDirectory(Directory directory, int dirStartOffset)    {        if (dirStartOffset>=_data.length || dirStartOffset<0) {            directory.addError("Ignored directory marked to start outside data segement");            return;        }        // First two bytes in the IFD are the tag count        int dirTagCount = get16Bits(dirStartOffset);        if (!isDirectoryLengthValid(dirStartOffset)) {            directory.addError("Illegally sized directory");            return;        }        // Handle each tag in this directory        for (int dirEntry = 0; dirEntry<dirTagCount; dirEntry++) {            int dirEntryOffset = calculateDirectoryEntryOffset(dirStartOffset, dirEntry);            int tagType = get16Bits(dirEntryOffset);            int formatCode = get16Bits(dirEntryOffset + 2);            if (formatCode<0 || formatCode>MAX_FORMAT_CODE) {                directory.addError("Invalid format code: " + formatCode);                continue;            }            // 4 bytes indicating number of formatCode type data for this tag            int componentCount = get32Bits(dirEntryOffset + 4);            int byteCount = componentCount * BYTES_PER_FORMAT[formatCode];            int tagValueOffset = calculateTagValueOffset(byteCount, dirEntryOffset);            if (tagValueOffset<0) {                directory.addError("Illegal pointer offset value in EXIF");                continue;            }            // Calculate the value as an offset for cases where the tag represents directory            int subdirOffset = TIFF_HEADER_START_OFFSET + get32Bits(tagValueOffset);            switch (tagType) {                case TAG_EXIF_OFFSET:                    processDirectory(_metadata.getDirectory(ExifDirectory.class), subdirOffset);                    continue;                case TAG_INTEROP_OFFSET:                    processDirectory(_metadata.getDirectory(ExifInteropDirectory.class), subdirOffset);                    continue;                case TAG_GPS_INFO_OFFSET:                    processDirectory(_metadata.getDirectory(GpsDirectory.class), subdirOffset);                    continue;                case TAG_MAKER_NOTE:                    processMakerNote(tagValueOffset);                    continue;                default:                    processTag(directory, tagType, tagValueOffset, componentCount, formatCode);                    break;            }        }        // At the end of each IFD is an optional link to the next IFD.  This link is after        // the 2-byte tag count, and after 12 bytes for each of these tags, hence        int nextDirectoryOffset = get32Bits(dirStartOffset + 2 + 12 * dirTagCount);        if (nextDirectoryOffset!=0) {            nextDirectoryOffset += TIFF_HEADER_START_OFFSET;            if (nextDirectoryOffset>=_data.length) {                // Last 4 bytes of IFD reference another IFD with an address that is out of bounds                // Note this could have been caused by jhead 1.3 cropping too much                return;            }            // the next directory is of same type as this one            processDirectory(directory, nextDirectoryOffset);        }    }