following is my java code; it gives the correct answer in my PC, which is 6; but the submission gives 1; any wrong with my solution? or the java test case is broken?

```
public int guessNumber(int n) {
int i = 1;
int j = n;
while (i <= j) {
int k = i + (j - i) / 2;
int r = guess(k);
if (r == 0) {
return k;
}
if (r < 0) {
i = k + 1;
} else {
j = k - 1;
}
}
return i;
}
private int guess(int k) {
return k - 6;
}
```