code: private boolean checkType(int tagid, int tagType, int n) {
      if (TiffTags.hasTag(tagid) && !TiffTags.getTag(tagid).getName().equals("IPTC")) {
        boolean found = false;
        String stagType = TiffTags.getTagTypeName(tagType);
        if (stagType != null) {
          if (stagType.equals("SUBIFD"))
            stagType = "IFD";
          if (stagType.equals("UNDEFINED"))
            stagType = "BYTE";
          for (String vType : TiffTags.getTag(tagid).getType()) {
            String vType2 = vType;
            if (vType2.equals("UNDEFINED"))
              vType2 = "BYTE";
            if (vType2.equals(stagType)) {
              found = true;
            }
          }
        }
        if (!found) {
          validation.addError("Incorrect type for tag " + TiffTags.getTag(tagid).getName(),
              "IFD" + n, stagType);
          return false;
        }
        return true;
      }
      return false;
    }
docs: Check tag type.
  
  @param tagid the tagid
  @param tagType the tag type
  @param n the n