1、获取高4位bit值
public int getHeight4(byte data){
//获取高四位
int height;
height = ((data & 0xf0) >> 4);
return height;
}
2、获取低4位bit值
public int getLow4(byte data){
//获取低四位
int low;
low = (data & 0x0f);
return low;
}
3、获取第i位的bit值
//b为传入的字节,i为第几位(范围0-7),如要获取bit0,则i=0
public int getBit(byte b,int i) {
int bit = (int) ((b >> i