public class Demonstrate {
 public static void main (String argv[]) {
  System.out.println (powerOf2 (4));
 }
 public static int powerOf2 (int n) {
  int result = 1;               // Initial value is 1
  while (n != 0) {
    result = 2 * result;        // Multiplied by 2 n times
    n = n - 1;
  }
  return result;
 }
}
