So in Java, I have:
long value = 1324623451867855123L
I need the 36 least significant bits, the MOST significant bits can be thrown out. In my head, I could use bitwise and and just do
long rightMost36Bits = value & 0xFFFFFFFFFL
And that would give me the bottom 36 bits. But… not so worky. What am I missing?
Edit
Fixed typo, meant & for and.
Edit2
Really wanted bottom 10 decimal digits. So I should just use % 10000000000. Sorry for over engineering a solution 🙂
The result from that equation is 12444252435. That is not what I want. I want more like 451867855132
That should be value & 0xFFFFFFFFFL. You used ^ which is XOR.