CS2
Recursion
16
Example
nWrite a recursive or non-recursive method powerOfTwo that computes 2 to the power of n.  You may assume that n is a positive integer.  You are not allowed to use the Math class.
npublic int powerOfTwo( int n ) {

  if ( n == 1 )
return 2;
  else
    return 2 * powerOfTwo( n-1 );