Given this code, which prints all the bits as a whole:
private string getBitLiteral(bool bitVal) { if (bitVal) { return ("1"); } else { return ("0"); } }
Int64 intThisHand = 127; for (int i = 64; i > 0; i--) { HttpContext.Current.Response.Write( getBitLiteral((intThisHand & (1 << i)) != 0) ); }
Why is he typing:
1000000000000000000000000011111110000000000000000000000000111111
Firstly, I loop correctly, since I expect the last 7 digits to be 1
Secondly, why is there 1 in the middle? I would expect all of them to be 0, except for the final 7 1.
source share