I just came across the need to calculate the digits of a number. It sounds trivial as we can see the digits & count them easily. Eu apenas entrou em toda a necessidade de calcular os dígitos de um número. Soa trivial como podemos ver os dígitos e contar-los facilmente.
The challenge is how to find them (with least effort) computationally? O desafio é como encontrá-los (com menos esforço) computacionalmente?

Solution: Solução:

1 + (int) (Math.log(i) / base10) 1 + (int) (Math.log (i) / base10)

where base10 = Math.log(10) onde base10 = Math.log (10)