c#中 字节数组到浮点型转换

第一种方法:     

byte j1 = ReceiveBytes[4]; //还原第1字节(低位) int j2 = ReceiveBytes[5] * 256; //还原第2字节 << 8 int j3 = j1 + j2;//得到整型 float j4 = j3 / 1000;

串口通信中用到的     http://www.cnblogs.com/binfire/archive/2011/10/08/2201973.html   讲了串口通信操作

第二种方法:


 float S_acc_x = (float)((Int16)(ReceiveBytes[j] << 8 | ReceiveBytes[j + 1])) / 100;//字节处理
 
发现自己的不足,善于利用找到的方法去扬长避短。行动起来。
原文地址:https://www.cnblogs.com/rechen/p/5089066.html