code: private boolean readHeader() {
      boolean correct = true;
      ByteOrder byteOrder = ByteOrder.LITTLE_ENDIAN;
      int c1 = 0;
      int c2 = 0;
      try {
        c1 = data.readByte().toInt();
        c2 = data.readByte().toInt();
      } catch (Exception ex) {
        validation.addErrorLoc("Header IO Exception", "Header");
      }
  
      // read the first two bytes, in order to know the byte ordering
      if (c1 == 'I' && c2 == 'I') {
        byteOrder = ByteOrder.LITTLE_ENDIAN;
      } else if (c1 == 'M' && c2 == 'M') {
        byteOrder = ByteOrder.BIG_ENDIAN;
      }
      else if (byteOrderErrorTolerance > 0 && c1 == 'i' && c2 == 'i') {
        validation.addWarning("Byte Order in lower case", "" + c1 + c2, "Header");
        byteOrder = ByteOrder.LITTLE_ENDIAN;
      } else if (byteOrderErrorTolerance > 0 && c1 == 'm' && c2 == 'm') {
        validation.addWarning("Byte Order in lower case", "" + c1 + c2, "Header");
        byteOrder = ByteOrder.BIG_ENDIAN;
      } else if (byteOrderErrorTolerance > 1) {
        validation.addWarning("Non-sense Byte Order. Trying Little Endian.", "" + c1 + c2, "Header");
        byteOrder = ByteOrder.LITTLE_ENDIAN;
      } else {
        validation.addErrorLoc("Invalid Byte Order " + c1 + c2, "Header");
        correct = false;
      }
      if (correct) {
        tiffModel.setByteOrder(byteOrder);
        data.setByteOrder(byteOrder);
  
        try {
          // read magic number
          int magic = data.readShort().toInt();
          tiffModel.setMagicNumber(magic);
        } catch (Exception ex) {
          validation.addErrorLoc("Magic number parsing error", "Header");
          correct = false;
        }
      }
      return correct;
    }
docs: Reads the Tiff header.
  
  @return true, if successful