You are right. Though the way it works in Java that isn’t touched. I meant the MSB past the sign bit. So technically the second most significant bit. Or the most significant number bit. Should have been a bit more clear on that. In short for small enough numbers this code works. Which is good enough for demonstration code. Which is the whole point.
View all comments
Show parent comment
39
u/mansdem Mar 13 '21
The type is a long though? Does the most significant bit of a long not get set?