By the way,
you should not use Math.pow() to find integer powers of integers. It is a slow and inaccurate way to do the job. In some cases, you may not care about "slow", but you should always care about "inaccurate".
If you want the square of integer "x", write "x*x". If you want the cube, write "x*x*x".
If you want an arbitrary power of an integer, you could use a simple loop.
By keeping all the arithmetic as integer, the answer is guaranteed to be exactly correct (unless you overflow the range of the integer type).
For small integer powers of floats and doubles, you should also avoid Math.pow(). Certainly, it is better to square a double "d" by writing "d*d", than to use Math.pow(d, 2.0).
[ December 03, 2007: Message edited by: Peter Chase ]