public boolean inOrder(int a, int b, int c, boolean bOk) { return (bOk || a < b) && b < c; } // NOTE: this does NOT work! the parentheses are necessary // WHY? && is evaluated before || (order of operations) // so this is evaluated as if the parentheses were as follows: // return bOk || (b > a && c > b); public boolean inOrder(int a, int b, int c, boolean bOk) { return bOk || a < b && b < c; } public boolean inOrder(int a, int b, int c, boolean bOk) { if (bOk) { return b < c; } else { return a < b && b < c; } }