title: Finding the number of digits of an integer
body: <p>What is the best method to find the number of digits of a positive integer?</p>
  
  <p>I have found this 3 basic methods:</p>
  
  <ul>
  <li><p>conversion to string</p>
  
  <pre><code>String s = new Integer(t).toString(); 
  int len = s.length();
  </code></pre></li>
  <li><p>for loop</p>
  
  <pre><code>for(long long int temp = number; temp &gt;= 1;)
  {
      temp/=10;
      decimalPlaces++;
  } 
  </code></pre></li>
  <li><p>logaritmic calculation</p>
  
  <pre><code>digits = floor( log10( number ) ) + 1;
  </code></pre></li>
  </ul>
  
  <p>where you can calculate log10(x) = ln(x) / ln(10) in most languages.</p>
  
  <p>First I thought the string method is the dirtiest one but the more I think about it the more I think it's the fastest way. Or is it?</p>