public static boolean checkForAnd(byte[] filterStringAsByteArray, int indexOfAnd)
    throws CharacterCodingException {

    try {
      if (
        filterStringAsByteArray[indexOfAnd] == ParseConstants.A
          && filterStringAsByteArray[indexOfAnd + 1] == ParseConstants.N
          && filterStringAsByteArray[indexOfAnd + 2] == ParseConstants.D
          && (filterStringAsByteArray[indexOfAnd - 1] == ParseConstants.WHITESPACE
            || filterStringAsByteArray[indexOfAnd - 1] == ParseConstants.RPAREN)
          && (filterStringAsByteArray[indexOfAnd + 3] == ParseConstants.WHITESPACE
            || filterStringAsByteArray[indexOfAnd + 3] == ParseConstants.LPAREN)
      ) {
        return true;
      } else {
        return false;
      }
    } catch (ArrayIndexOutOfBoundsException e) {
      return false;
    }
  }
Checks if the current index of filter string we are on is the beginning of the keyword 'AND'
<p>
@param filterStringAsByteArray filter string given by the user
@param indexOfAnd              index at which an 'A' was read
@return true if the keyword 'AND' is at the current index
hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ParseFilter.java