title: Understanding integral division
body: <p>I have the following piece of code:</p>
  
  <pre><code>public static final long KILOMETER_IN_METERS = 1000;
  
  public static int getKilometers(int distanceInMeter) {
      return (int) Math.floor(distanceInMeter / KILOMETER_IN_METERS);
  }
  </code></pre>
  
  <p>And for the line with the <strong>return</strong> statement Sonar says:</p>
  
  <pre>
  Integral division result cast to double or float
  </pre>
  
  <p><a href="https://dev.eclipse.org/sonar/rules/show/findbugs:ICAST_IDIV_CAST_TO_DOUBLE?layout=false" rel="nofollow">Here is the full description of this bug.</a></p>
  
  <p><br/>
  As far as I understand, it says there is <strong>int/int</strong> division whose result could be a <strong>floating value</strong>, but I could be wrong.<br>
  How can I handle this case correctly?    </p>