title: How to get the length of a numbers fraction part?
body: <p>How do I find out the length or the number of digits of the fraction part of a decimal number?</p>
  
  <p>I can see a few aproaches, e.g. with Strings like this one:</p>
  
  <pre><code>public static int getNumberOfFractionDigits(Number number) {
      Double fractionPart = number.doubleValue() - number.longValue();
      return fractionPart.toString().length() - 2;
  }
  </code></pre>
  
  <p>But what is the best way to determine the length?</p>
  
  <p>I could imagine some problems if I use Strings, e.g. because the locale and number format may be different from system to system. Is there a nice way to calculate it? Maybe without iteration?</p>
  
  <p>Thanks in advance.</p>