You can either do it the "cheating" way by converting into a String, looping through and using Character.numericValue(s.charAt(n)), or do it a better way by repeatedly dividing by 10 and looking at the result modulus 10.
Luigi, I appreciate your help a lot, do you think you could give a little more of an example for the second option? Like give some code? I'm sorry, I'm just having some trouble following.
You should know by now that that's not how things work here. Please read: NotACodeMill. Are you saying you can't even get started at all? You've already been give two algorithms. Give one of them a try!
Ok, that's not that hard, whatever the input, convert to a string, get the length() of that string, convert back to an int and put that as the maximum amount.
That's what I'm not trying to get at though. I don't know how to separate the digits of a number.
Hint: you are expecting a different value for every iteration of your loop. Yet, the loop changes nothing. So how could the result of each iteration change?
My advice: back away from the keyboard and solve the problem with pencil and paper mathematically before trying to write code that mirrors the solution that you come up with.