int numberOfDigits(int number) { int count = 0; while (number != 0) { count++; number ~/= 10; } return count; }