Just out of curiosity, how can you tell if a number x is a power of two (x = 2^n) without using recursion.
Thanks
Math.log(x)/Math.log(2) == Math.floor(Math.log(x)/Math.log(2))