Why does this expression always result in -2,147,483,648 (11111111 11111111 11111111 11111111)? I don't get it. data[] is a byte-Array filled with some values.
(((int)data[29] & 0x00000001) << 31) | (((int)data[30]&0x000000FF)<<12) | (((int)data[31]&0x000000FF)<<4) | (((int)data[32]&0x000000FF)>>>4)
Thanks.
I don't think your expression always returns min value of signed int. if all values in
data
array were zero, it would return zero.I also don't think this would result in setting all bits to ones.
Following code (Java) where I use
Integer.MAX_VALUE
:returns:
using provided values:
returns: