title: How can I represent a range in Java?
body: <p>Let's say an integer should be within the range: <code>[0...2147483647]</code></p>
  
  <p>I want to check whether an integer variable falls within this range. I know it can be accomplished by a simple if-else statement, but is there a more efficient way to check whether it's within the range? </p>
  
  <p>I'd rather not do this:</p>
  
  <pre><code>if (foo &gt;= 0 &amp;&amp; foo &lt;= 2147483647) 
  {
      // do something
  }
  </code></pre>