code: private int readFlags(byte flags) {
  
  		// Verify the reserved bits at 7 and 6 are 0
  		int reserved7 = (flags >> 7) & 1;
  		int reserved6 = (flags >> 6) & 1;
  		if (reserved7 != 0 || reserved6 != 0) {
  			throw new GeoPackageException(
  					"Unexpected GeoPackage Geometry flags. Flag bit 7 and 6 should both be 0, 7="
  							+ reserved7 + ", 6=" + reserved6);
  		}
  
  		// Get the binary type from bit 5, 0 for standard and 1 for extended
  		int binaryType = (flags >> 5) & 1;
  		extended = binaryType == 1;
  
  		// Get the empty geometry flag from bit 4, 0 for non-empty and 1 for
  		// empty
  		int emptyValue = (flags >> 4) & 1;
  		empty = emptyValue == 1;
  
  		// Get the envelope contents indicator code (3-bit unsigned integer from
  		// bits 3, 2, and 1)
  		int envelopeIndicator = (flags >> 1) & 7;
  		if (envelopeIndicator > 4) {
  			throw new GeoPackageException(
  					"Unexpected GeoPackage Geometry flags. Envelope contents indicator must be between 0 and 4. Actual: "
  							+ envelopeIndicator);
  		}
  
  		// Get the byte order from bit 0, 0 for Big Endian and 1 for Little
  		// Endian
  		int byteOrderValue = flags & 1;
  		byteOrder = byteOrderValue == 0 ? ByteOrder.BIG_ENDIAN
  				: ByteOrder.LITTLE_ENDIAN;
  
  		return envelopeIndicator;
  	}
docs: Read the flags from the flag byte and return the envelope indicator
  
  @param flags
  flags byte
  @return envelope indicator