title: Java doing Math not as expected
body: <p>I have this really weird problem with Java. Basicly, this is what is going on:</p>
  
  <pre><code> int i = (int) Math.ceil((30 * 50) / 1000);
  </code></pre>
  
  <p>which would be the same as</p>
  
  <pre><code> int i = (int) Math.ceil(1.5);
  </code></pre>
  
  <p>but it doesn't return 2, it returns 1! However, the seccond line does return 2! This is really weird...</p>
  
  <p>If it helps, here's the actual line of code:</p>
  
  <pre><code>            pStats.setPlayerEnergy(
                  player,
                  pStats.getPlayerEnergy(player)
                          + (int) Math.ceil((pStats.getPlayerFoodTick(player) * pStats
                                  .getPlayerHydrationTick(player)) / 1000));
  </code></pre>
  
  <p>Does anyone have an idea what's going on here and how to fix it?</p>