Java : how do I get the precision part in the decimal?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/8890472/java-how-do-i-get-the-part-after-the-decimal-point">Java : how do I get the part after the decimal point?</a>  </p>
</blockquote>



<p>In my <a href="http://stackoverflow.com/questions/8890472/java-how-do-i-get-the-part-after-the-decimal-point">previous post</a> I didn't give proper explanation. This is my exact scenario.</p>

<p>I have a <code>double</code> variable <code>d = 1.15</code>.</p>

<p>I want the number after the decimal point, i.e. "15".</p>

<p>What is best way to achieve this in Java?</p>

<p>I have tried like this:</p>

<pre><code>Double d = 1.15;
String str = d.toString();
int len = str.substring(str.indexOf(".")).length() - 1;
int i= (int) (d * (long)Math.pow(10,len) % (long)Math.pow(10,len));
</code></pre>

<p>But I didn't get the proper answer because when I convert <code>d.toString()</code> the answer is <code>14.999999999999986</code>.</p>
