-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
进制转化的一些疑惑 #6
Comments
因为存在二进制补码问题 |
是的,的确存在二进制补码的问题。但是这个问题应该是发生在低位转高位的时候。
但是像下面这样的高位转低位也存在补码的问题吗?
|
你好,你说的是高到低没有问题的,此时写上0xff就是看着明确点 |
好的,谢谢你的解答 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
不明白,为什么int转为byte类型还需要用 i&0xff呢?
我的理解是因为(byte)的强制转化是针对int类型的低8位的,所以就算i没有进行 &0xff的操作,也是不会影响到该值的吧。
所以高字节的int转低字节的byte是不是可以写成:
The text was updated successfully, but these errors were encountered: