Convert long to two int and vice versa
int, java, long-integer
Solution
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.
Problem
How can I convert two 32 bit integers (`int`) to one 64 bit `long` and vice versa?