byte[] command = new byte[2];
double test1 = 1234;
UInt16 result = (UInt16)(test1);
command[0] = (byte)(result >> 8);//高位
command[1] = (byte)(result & 0xff);//低位
Console.WriteLine("{0}", FormatBytes(command) );
將byte數(shù)組(長(zhǎng)度2东抹,高字節(jié)在前掌猛,低字節(jié)在后)笑旺,轉(zhuǎn)成double數(shù)據(jù);
byte[] command2 = new byte[2] { 0x15, 0xee };
double result2 = command2[0] * 256 + command2[1];
Console.WriteLine("{0}", result2);