When I test this code it always returns 0 and I'm not sure why.

```
public class test {
    public int sumOfDigits(String s) {
        int sum = 0;
        for (int i=0; i<s.length(); i++) {
            char cur = s.charAt(i);

            if (cur >= 0 && cur <= 9) {
                sum += cur - '0';
            }
        }

        return sum;
    }
}

```