title: What happens when converting double (or floats) to ints?
body: <p>I'm practicing some simple 2D game programming, and came up with a theory that during animation (the actual change in a image position is best calculated with floating point numbers). I have a feeling that if you move an image around with ints the animation won't be as smooth. </p>
  
  <p>In Java it seems you can't draw an image with floating point numbers to give an image a position. But apparently when you initially declare your <strong>x</strong> and <strong>y</strong> 's, you can declare them as Double, or Float, and when it comes to actually drawing the image you have to cast them to ints. Like I find <a href="http://www.cokeandcode.com/info/showsrc/showsrc.php?src=../spaceinvaders/org/newdawn/spaceinvaders/Entity.java" rel="noreferrer">HERE</a> :</p>
  
  <pre><code>    /**
   * Draw this entity to the graphics context provided
   * 
   * @param g The graphics context on which to draw
   */
  public void draw(Graphics g) {
      sprite.draw(g,(int) x,(int) y);
  }
  </code></pre>
  
  <p>My question is about how Java handles the conversion? 
  If the code casts these doubles at the last minute, why have them as doubles in the first place? 
  Does Java hide the numbers after the decimal?</p>
  
  <p>I know in C and C++ the numbers after the decimal get cut off and you only see whats before it. How does Java handle this casting?</p>