code: public int findFirstEyeCatcher(byte[] buffer, int off, int len) {
  		if (off < 0 || off >= buffer.length) {
  			throw new IllegalArgumentException("Offset should be in the buffer boundaries");
  		}
  		if (off + len > buffer.length) {
  			len = buffer.length - off;
  		}
  		// i - pointer in eyeCatcher, p - in the buffer.
  		int p = off + EYE_CATCHER.length - 1;
  		for (int i=EYE_CATCHER.length-1; i>=0; i--, p--) {
  			if (p >= off + len) {
  				return -1;
  			}
  			byte b = buffer[p];
  			if (b != EYE_CATCHER[i]) {
  				if (i == EYE_CATCHER.length-1) {
  					// Check if the byte is from the middle of the EYE_CATCHER
  					for (i--; i>=0; i--) {
  						if (b == EYE_CATCHER[i]) {
  							break;
  						}
  					}
  					// shift buffer to have the byte in i-th position
  					p += EYE_CATCHER.length - i;
  				} else {
  					// the whole buffer should be shifted due to the assumption.
  					p += EYE_CATCHER.length * 2 - i;
  				}
  				i = EYE_CATCHER.length;
  			}
  		}
  		return p+1;
  	}
docs: assumption that the EYE_CATCHER does not have repeatable bytes.