[Solved] how do you count the number of digits in an int?
You can use split to find all the matches String number = “128”; String digit = “2”; // expensive but simple. int matches = number.split(digit).length – 1; Say you want to use a loop and something like contains. // no objects char digit=”2″; int count = 0; for (int pos = number.indexOf(digit); pos >= 0; … Read more