title: Checking an int within range
body: <p>Is there an elegant way in java to check if an int is equal to, or 1 larger/smaller than a value.</p>
  
  <p>For example, if I check <code>x</code> to be around <code>5</code>. I want to return true on <code>4, 5 and 6</code>, because 4 and 6 are just one away from 5.</p>
  
  <p>Is there a build in function to do this? Or am I better off writing it like this?</p>
  
  <pre><code>int i = 5;
  int j = 5;
  if(i == j || i == j-1 || i == j+1)
  {
      //pass
  }
  //or
  if(i &gt;= j-1 &amp;&amp; i &lt;= j+1)
  {
      //also works
  }
  </code></pre>
  
  <p>Of course the above code is ugly and hard to read. So is there a better way?</p>