title: java Integer.MAX_VALUE, MIN_VALUE overflow
body: <p>Ok maybe I am just tired because of this but how can I accomplish this?</p>
  <pre><code>int x = Integer.MAX_VALUE+10;
  </code></pre>
  <p>// or perhaps</p>
  <pre><code>int x = Integer.MIN_VALUE-20;
  </code></pre>
  <p>I just want the if statement to catch if x is &quot;within range&quot; kinda like this:</p>
  <pre><code>if(x &gt;= Integer.MAX_VALUE || x &lt;= Integer.MIN_VALUE){ //throw exception}
  </code></pre>
  <p>But the problem is that if the value is as mentioned above, like MAX_VALUE + 10, the value ends up being neither higher than the MAX VALUE nor lower than the MIN_VALUE and the if-conditions aren't met...</p>
  <p>Edit: To clarify what I meant:
  I don't want to actually store any values bigger than the max/min value.
  Imagine this:</p>
  <p>A field, you write 10+10 and it says like &quot;Ok, that's 20&quot;
  Next up, someone maybe will write 1000000<em>100000 and it will respond with the answer as well
  but then someone might write something that exceeds the max/min values like, 10000000</em>1000000*1000000 or someyhing like that and then the program should be all like &quot;Hold up, that's way too high! here's a &quot;0&quot; for you instead&quot;</p>