public static void main(String[] args) {
long x = 164997969936395L;
int a = (int)(x >>> 16);
System.out.println(a); //Prints -1777298077
long b = (x >>> 16);
System.out.println(b); //Prints 2517669219
}
Trying to bitshift x by 16 bits, but the output differs depending on whether i use a long or an int, also it seems when i use long the negative signs are always gone.
I've also noticed when using int it really is divided by 2^16 whereas using long it is not, what's happening there?