LTM Limited interview question

The asked Amostrong number code in Java