title: How to implement infinity in Java?
body: <p>Does Java have anything to represent infinity for every numerical data type? How is it implemented such that I can do mathematical operations with it?</p>
  
  <p>E.g.</p>
  
  <pre><code>int myInf = infinity; //However it is done
  myInf + 5; //returns infinity
  myInf*(-1); //returns negative infinity
  </code></pre>
  
  <p>I have tried using very large numbers, but I want a proper, <strong>easy</strong> solution.</p>