Create a procedure that takes a number and returns its multiplicative persistence , which is the number of times you must multiply the digits in num until you reach a single digit.
Examples
bugger(39) ➞ 3
// Because 3 * 9 = 27, 2 * 7 = 14, 1 * 4 = 4 and 4 has only one digit.
bugger(999) ➞ 4
// Because 9 * 9 * 9 = 729, 7 * 2 * 9 = 126, 1 * 2 * 6 = 12, and finally 1 * 2 = 2.
bugger(4) ➞ 0
// Because 4 is already a one-digit number.
public static int Bugger(int num){
int count = 0;
int nu = num;
while(Integer.toString(nu).length()>1){
String str = String.valueOf(nu);
String[] n = str.split("(?<=.)");
int test = 1;
for ( String i:n) {
test = Integer.parseInt(i)*test;
}
nu = test;
count ++;
}
return count;
}