How can I convert two 32 bit integers (int
) to one 64 bit long
and vice versa?
long c = (long)a << 32 | b & 0xFFFFFFFFL; int aBack = (int)(c >> 32); int bBack = (int)c;
In Java, you don't need quite so many parentheses, or any masking on the reverse calculation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With