Bitwise XOR java long

这一生的挚爱 提交于 2019-12-01 05:47:59

You need an L at the end of the first integer literal:

long a = 0x0000000080000001L ^ 0x4065DE839A6F89EEL;

Otherwise it is an int literal, not a long (the leading zeroes being ignored). The ^ operator then promotes the first operand value from 0x80000001 to a long, but since the sign bit is set, the result of the promotion is 0xFFFFFFFF80000001L.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!