Possible Duplicate:
The most efficient way to implement an integer based power function pow(int, int)
I know this question is pretty easy but my requirement is that I want to compute x to power x where x is a very large number in the best optimize way possible. I am not a math geek and therefore need some help to figure out the best way possible.
In java, we can use BigInteger but how to optimize the code? Any specific approach for the optimization?
Also using recursion will the large value of x, makes the code slow and prone to stack overflow error?
Eg: 457474575 raise to power 457474575