Angsuman's Java Blog

News and views from my perspective as a Chief Software Architect and CEO. Focused on Java and Web Technologies.

Sunday, September 28, 2003

Thanks Google for freeing up Blogging!

BLOGGER: Important Blogger Pro Announcement

How to calculate the digits of a positive integer?

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

where base10 = Math.log(10)

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. How do you find them computationally?