I'm not entirely sure what it is in java, although it might be a function such as pow() or it could even actually be 2^2 (^ is the power operator in C#, might be the same in Java).
However, just to correct you on your above question, 2*=2 is equivalent to 2 = 2 * 2 (or a = a * b). It just so happens that in your example 2*=2 and 2 raised to the power of 2 produce the same answer.
You can either do it recursively (using the base case as 2^0 = 1) - probably not as good performance wise (but it looks neat in programming terms), or use an iterative method.
elkdanger said:
I'm not entirely sure what it is in java, although it might be a function such as pow() or it could even actually be 2^2 (^ is the power operator in C#, might be the same in Java).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.