Hoping for something more elegant than
if (i>0 && i<100)
if you are using Spring data you can also use the Range object from Spring.
range = new org.springframework.data.domain.Range(3, 8); range.contains(5) will return true.
You could add spacing ;)
if (i > 0 && i < 100)
if ( 0 < i && i < 100)
if ( 'a' <= c && c <= 'z' )
if(i <= 0 || i >=100)
It will work.
I think
if (0 < i && i < 100)
is more elegant. Looks like maths equation.
If you are looking for something special you can try:
Math.max(0, i) == Math.min(i, 100)
at least it uses library.
If you're looking for something more original than
if (i > 0 && i < 100)
you can try this
import static java.lang.Integer.compare;
...
if(compare(i, 0) > compare(i, 100))