Is there any operator or trick for such operation? Or is it necessary to use this:
if (5 < i && i < 10) {
// ...
}
There is no such thing in Java (unless you work with booleans).
The 5<i
results in a boolean on the left side on <10
which the compiler dislikes.