Java中的移位
来源:互联网 发布:淘宝卖什么销量最好 编辑:程序博客网 时间:2024/05/16 05:35
3本身:0000 0000 0000 0000 0000 0000 0000 0011(没疑问)
3<<30: 1100 0000 0000 0000 0000 0000 0000 0000(没疑问)
3<<31: 1000 0000 0000 0000 0000 0000 0000 0000(没疑问)
3<<32: 0000 0000 0000 0000 0000 0000 0000 0011(奇怪啊,最后四位应该是 0000 才对啊)
最后面的问题搞不定,谁能解释下啊
=========================================================================
找到答案了:
Java™ Language Specification, Third Edition -- 15.19. Shift Operators
If the promoted type of the left-hand operand is int, only thefive lowest-order bits of the right-hand operand are used as the shift distance. It is as if the right-hand operand were subjected to a bitwise logical AND operator & (§15.22.1) with the mask value 0x1f. The shift distance actually used is therefore always in the range 0 to 31, inclusive.
If the promoted type of the left-hand operand is long, then only the six lowest-order bits of theright-hand operand are used as the shift distance. It is as if the right-hand operand were subjected to a bitwise logical AND operator & (§15.22.1) with the mask value 0x3f. The shift distance actually used is therefore always in the range 0 to 63, inclusive.
- Java中的移位操作
- Java中的移位操作
- Java中的移位符
- java中的移位运算
- java中的移位运算
- Java中的移位
- java中的移位操作
- java中的移位操作
- java中的移位 <<<
- java中的移位操作
- java中的移位操作
- Java中的移位操作
- JAVA中的移位运算
- Java中的移位操作符
- java中的移位运算符
- java中的移位运算符
- Java中的移位操作符
- java中的移位运算符:<<,>>,>>>
- POJ 1654 Area
- 注册Jdbc驱动程序的三种方式
- 关于蓝牙聊天室的设计与实现
- 网上下载图片并保持到SD卡中+读取SD卡中的图片
- UNIX文件属性(1)
- Java中的移位
- 爱立信实验室实习感想(一)
- JSON
- linux信号处理函数的可重入性
- HTML <ol>标签简介
- 点击选中radio
- 回顾php与html测试
- struts2 <s:textfield> value属性设置问题
- 那些年,在Fragment中犯的错