Pergunta de entrevista da empresa UBS

One of the java questions is a digit sum question.