title: Java: Assigning a value too big directly vs. integer wrap around
body: <p>I have been exploring how Java deals with integer overflow and underflow and I came across these 2 situations:</p>
  
  <p>If a value out of range is assigned to an int directly, there could be no wrap around and it depends on the conversion:</p>
  
  <pre><code>    long tooBigLong=2147483648L;
      int integerL=(int)tooBigLong;
  
      double tooBigDouble=Math.pow(2, 31);
      int integerD=(int)tooBigDouble;
  </code></pre>
  
  <p>results: </p>
  
  <p><code>Converted from Long to int: -2147483648</code></p>
  
  <p><code>Converted from Double to int: 2147483647</code></p>
  
  <p>It seems that a integer wrap around would only occur when I convert from Long to int. </p>
  
  <p>But I do want to figure out how it wouldn't work for a double to int conversion? 
  Thanks for the help!  </p>