title: Why does dividing a float by an integer return 0.0?
body: <p>So if I have a range of numbers '0 - 1024' and I want to bring them into '0 - 255', the maths would dictate to divide the input by the maximum the input will be (1024 in this case) which will give me a number between 0.0 - 1.0. then multiply that by the destination range, (255).</p>
  
  <p>Which is what I want to do!</p>
  
  <p>But for some reason in Java (using Processing) It will always return a value of 0.</p>
  
  <p>The code would be as simple as this</p>
  
  <pre><code>float scale;
  scale = (n/1024) * 255;
  </code></pre>
  
  <p>But I just get 0.0. I've tried double and int. all to no avail. WHY!?</p>