开发者

Bitwise manipulation of signed integers [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago. 开发者_如何学Go
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();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜