UNB/ CS/ David Bremner/ teaching/ java/ EvalNumber2.java
// simplified version, base ten only

public class EvalNumber2{
    private static long evalNumber(String digits){
        int len=digits.length();
        if (len==1)
            return evalDigit(digits);

        return 10*evalNumber(digits.substring(0,len-1))
                               +evalDigit(digits.substring(len-1));
    }

    private static int evalDigit(String digit){
        return digit.charAt(0)-'0';
    }
        

    public static void main(String[] args){
        System.out.println(evalNumber("666"));
        System.out.println(evalNumber("101"));
    }

}
//