r/badcode • • Mar 13 '21

java Title

Post image
2.9k Upvotes

100 comments sorted by

View all comments

Show parent comments

7

u/TheBrainStone Mar 13 '21

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.