public class PowerExample3 { public static void main (String[] argv) { int p = power (3, 2); System.out.println ( "3^2 = " + p); p = power (3, 4); System.out.println ( "3^4 = " + p); p = power (2, 8); System.out.println ( "2^8 = " + p); } static int power (int a, int b) { if (b == 0) { return 1; } return (a * power (a, b-1)); } }