Given three ints, a b c, return true if b is greater than a, and c is greater than b. However, with the exception that if "bOk" is true, b does not need to be greater than a.

inOrder(1, 2, 4, false) → true
inOrder(1, 2, 1, false) → false
inOrder(1, 1, 2, true) → true

1
2
3
4
5
6
7
public boolean inOrder(int a, int b, int c, boolean bOk) {
  if ((bOk && c>b) || (b>a && c>b)) {
    return true;
  } else {
    return false;
  }
}

Keresés

Ajánló