Home Segments Top Top Previous Next

449: Mainline

The recursivePowerOf2 method is an instance of the recursive counting pattern, in which a specified operand is combined by a specified operand with a recursive call:

public static int method name (int n) { 
 if (n == 0) {return result for n equal to 0;} 
 else { 
  return combination operand 
         combination operator 
         method name(n - 1); 
 } 
}