title: Java- Get decimal at position n
body: <p>What is the best way to get the decimal at position n from a float (by cutting out everything from the number except that decimal)?</p>
  
  <p>It should work like this:</p>
  
  <pre><code>getDecimal(3.654987, 4)  =&gt;  returns 0.0009
  getDecimal(3.654987, 2)  =&gt;  returns 0.05
  </code></pre>