UNB/ CS/ David Bremner/ teaching/ java/ Power.java
import java.math.BigInteger;
public class Power{

    static int power(int a, int b){
        int return_val;
        Trace.reverseIndent(b,"a= "+a + " b="+b);
        if (b==0) {
            return_val = 1;
        } else if ( b % 2 == 0) {
            return_val = power(a*a, b/2);
        } else {
            return_val = a*power(a,b-1);
        }
        Trace.reverseIndent(b,"power(a,b)= "+return_val);
        return return_val;
    }

    public static void main(String args[]){
        System.out.println(power(7,9));
    }
}