UBS Interview Question

One of the java questions is a digit sum question.