int byte转换

 //命令码0x8001转为int为32769,发送时反序
            byte[] bt = new byte[2] { 0x01, 0x80 };
            int lt1 = BitConverter.ToUInt16(bt, 0);

            //int to byte[]
            int i = 6231;
            byte[] b = BitConverter.GetBytes(i);

            //byte[] to int
            byte[] bb = new byte[] { 87, 24, 0, 0 };
            uint j = BitConverter.ToUInt32(bb,0);
            //sTemp=0x 57-18-00-00
            string sTemp = BitConverter.ToString(bb);
原文地址:https://www.cnblogs.com/xiaochun126/p/4158143.html