private int findValidBinaryOperator(List<ExpressionElement> list,
			Set<ExpressionOperator> operators, int startIndex) {

		// can't have a valid binary operator at the last index, so stop 1 before last
		for (int i = startIndex; i < list.size() - 1; i++) {
			if (operators.contains(list.get(i))) {
				// make sure the elements before and after the operator are value types so
				// that the caller can just cast them as values. If they are not, then
				// this operator won't be evaluated and at the end the evaluate process, the list
				// won't be reduced to just one element.
				if (list.get(i - 1) instanceof ExpressionValue &
					list.get(i + 1) instanceof ExpressionValue) {
					return i;
				}
			}
		}
		return -1;
	}
Evaluates a list of valid expression elements into a single final value.
@param list the list of valid expression elements.
@return the final value the expression evaluates to
@throws ExpressionException if sequence of expression elements is not in a valid order such
that it evaluates to a single value. (such as two values not being separated by an operator)
Ghidra/Framework/Generic/src/main/java/generic/expressions/ExpressionEvaluator.java