Bitwise manipulation of signed integers [closed]
int p= -6969317
int r=0xff & (p>>16);
what "r" will show and how?
Have a look at the bitwise operations.
If you want to see binary representation of your int
, use:
public static String toBitString(final int data){
final StringBuilder s = new StringBuilder(32);
for (int i = 31; i >= 0; i--) {
s.append(data >> i & 1);
}
return s.toString();
}
精彩评论