So this is my code so far.
public int getsum (int n){ int num = 23456; int total = 0; while (num != 0) { total += num
I think it's the shortest so far. The input thing is up too you, though.
public static int getSum(int input) { //example: input=246 int sum=0; if (input%10==input) { //246%10=6; return input%10; //2%10=2 } return input%10+getSum((input-input%10)/10); //(246-6)/10=24; 24%10=4 }