title: BigInteger: count the number of decimal digits in a scalable method
body: <p>I need the count the number of decimal digits of a <code>BigInteger</code>. For example:</p>
  
  <ul>
  <li><code>99</code> returns <code>2</code></li>
  <li><code>1234</code> returns <code>4</code></li>
  <li><code>9999</code> returns <code>4</code></li>
  <li><code>12345678901234567890</code> returns <code>20</code></li>
  </ul>
  
  <p>I need to do this <em>for a <code>BigInteger</code> with <code>184948</code> decimal digits and more</em>. <strong>How can I do this fast and scalable?</strong></p>
  
  <p>The <em>convert-to-String</em> approach is slow:</p>
  
  <pre><code>public String getWritableNumber(BigInteger number) {
     // Takes over 30 seconds for 184948 decimal digits
     return "10^" + (number.toString().length() - 1);
  }
  </code></pre>
  
  <p>This <em>loop-devide-by-ten</em> approach is even slower:</p>
  
  <pre><code>public String getWritableNumber(BigInteger number) {
      int digitSize = 0;
      while (!number.equals(BigInteger.ZERO)) {
          number = number.divide(BigInteger.TEN);
          digitSize++;
      }
      return "10^" + (digitSize - 1);
  }
  </code></pre>
  
  <p>Are there any faster methods?</p>