public class Demonstrate {
 public static void main (String argv[]) {
  System.out.print("2 to the 3rd power is ");
  System.out.println(recursivePowerOf2(3));
  System.out.print("2 to the 10th power is ");
  System.out.println(recursivePowerOf2(10));
 }
 public static int recursivePowerOf2 (int n) {
  if (n == 0) {
   return 1;
  }
  else {
   return 2 * recursivePowerOf2(n - 1);
  }
 }
}
