title: Power of Power to calculate in Java
body: <p>I have a program to write. The requirement is 1.    Implement code (choose your favorite language) which will calculate the value of 2^(3^(4^(5^6))) </p>
  
  <p>What I have written is this so far ( for 4^(5^6).However, I get 0 as output despite the fact I have even changed the second argument from integer to long.A little help is needed.Here is my code: </p>
  
  <pre><code>public static void main(String args[]) {
      int i=4,j=5,k=6;
      System.out.println(pow(i,pow(j,k)));
  }
  
  public static long pow(int c, long l){       
      long n=1;
      for(int i=0;i&lt;l;i++){
          n=c*n;
      }
      return n;            
  }
  </code></pre>