John Bass - 2016-05-31

the fix is:

public static int nextOp(int startAt, String expression) {
// Returns the integer value of the next operator in the expression, -1 if a
// closing bracket is found or if we get to the end of the expression
char aChar;
int balance=0;
for (int i = startAt; i < expression.length(); i++) {
aChar = expression.charAt(i);
if (balance == 0 && isOR(aChar))
return 0;
if (balance == 0 && isXOR(aChar))
return 1;
if (balance == 0 && isAND(aChar))
return 2;
if (aChar == '(') {
balance++;
}
if (aChar == ')') {
balance--;
if(balance == 0)
return -1;
}
}
return -1;
}