Verwenden Sie Log

int length = (int) (Math. log10(number) + 1)
Obnoxious Opossum