Java之“& 0x1”
来源:互联网 发布:网络借贷宝怎么还款啊 编辑:程序博客网 时间:2024/05/01 20:56
第一感觉这是一个与byte类型数据相关的运算符!
package bytes; public class ByteToBit { /** * @param args */public static void main(String[] args) {// TODO Auto-generated method stubSystem.out.println(byteToBit(new Integer(10).byteValue()));} public static String byteToBit(byte b) { return "" + (byte) ((b >> 7) & 0x1) + (byte) ((b >> 6) & 0x1) + (byte) ((b >> 5) & 0x1) + (byte) ((b >> 4) & 0x1) + (byte) ((b >> 3) & 0x1) + (byte) ((b >> 2) & 0x1) + (byte) ((b >> 1) & 0x1) + (byte) ((b >> 0) & 0x1); }}
b >> 7 将原第8位的bit值移到了第1位上,& 0x1的作用是只保留第一位的值,其余7位与0与将为0
参考至:http://www.plsyard.com/category/java/page/2/
0 0
- Java之“& 0x1”
- java.io.IOException: Prepare failed.: status=0x1
- java.io.IOException: Prepare failed.: status=0x1
- & 0x1的效果
- 0x1.Android Activity
- 位操作 0x1 << 3
- 位操作 0x1 << 3
- 漏洞本地演示0x1
- 十六进制 0x1.2P5
- java.lang.UnsupportedOperationException,Can't convert to dimension: type=0x1,TypedArray.java,702
- 编译错误之NMAKE : fatal error U1077: 'cscript' : return code '0x1'
- android错误之:android.content.res.Resources$NotFoundException: String resource ID #0x1
- Discuz!X1贴心小设计之 getglobal()
- java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
- android MediaPlayer java.io.IOException: Prepare failed.: status=0x1 解决
- Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
- java.io.IOException: Prepare failed.: status=0x1 异常解决方法
- java.io.IOException: Prepare failed.: status=0x1异常解决方法
- NFS v3 介绍
- CCSpriteBatchNode与CCTextureAtlas详解
- /lib/libc.so.6: version `GLIBC_2.7' not found
- shall编程
- PHP识别url重写请求
- Java之“& 0x1”
- adb devices 出现??? no permissions 的解决方法
- POJ 1733 Parity game (并查集)
- web.xml中load-on-startup的作用
- leetcode 2 MEDIAN OF TWO SORTED ARRAYS
- 敏捷宣言
- java 基础之网络编程 --09
- 停车场程序设计
- PB总结——游标,Datastore和存储过程的调用