short i=11111; byte[] buff = System.BitConverter.GetBytes(i);//short to bytes byte[2] i = 0; i=System.BitConverter.ToInt16(buff,0);)//bytes to short1byte == 8位2进制 ==1字节 short == 16位2进制 ==2字节 int == 32位2进制 ==4字节
可以通过移位实现一个byte放高位 一个byte放低位 byte lowByte,highByte; int i; LowByte = i >> 8; highByte = i && 0xFF; //&&是与操作,c好久不用.不知道忘了没
哦,反了 byte lowByte,highByte; int i; highByte = i >> 8; //高位 lowByte = i && 0xFF; //低位,&&是与操作?不知道忘了没
byte[] buff = System.BitConverter.GetBytes(i);//short to bytes byte[2]
i = 0;
i=System.BitConverter.ToInt16(buff,0);)//bytes to short1byte == 8位2进制 ==1字节
short == 16位2进制 ==2字节
int == 32位2进制 ==4字节
一个byte放低位
byte lowByte,highByte;
int i;
LowByte = i >> 8;
highByte = i && 0xFF; //&&是与操作,c好久不用.不知道忘了没
哦,反了
byte lowByte,highByte;
int i;
highByte = i >> 8; //高位
lowByte = i && 0xFF; //低位,&&是与操作?不知道忘了没