|
Well you have one obvious option which would be convert to a string and count the characters (possibly accounting for leading zeros depending on your task).
Another option might be to test the int against being less than 10, 100, 1000, etc. The max size for a int will mean you won't have to perform countless comparisons.
Finally you could look into log's, particularly log10 of the int.
|