Weird Java Math ,10 ^ 1 = 11?

Posted by Simon on Stack Overflow See other posts from Stack Overflow or by Simon
Published on 2010-04-20T02:43:01Z Indexed on 2010/04/20 2:53 UTC
Read the original article Hit count: 444

Filed under:
|

For an exercise I was writing a loop that turns a string into an integer without using the built in functions by multiplying each individual value by its numerical position. 75 would be 7*(10 ^ 1) + 5*(10 ^ 0), for example. However, for some reason (10 ^ 1) keeps coming back as 11. Is there some mistake I have made or an explanation for this?

© Stack Overflow or respective owner

Related posts about java

Related posts about math