First, note that you can eliminate the need to call powerOf2 in the simple case in which the value of the parameter is 0:
powerOf2
0
public static int recursivePowerOf2 (int n) { if (n == 0) { return 1; } else {return powerOf2(n);} }