字节数组 byte[] 与 int型数字的相互转换

byte数组转换为int

byte[] bytes = {0xff, 0xff};

int num = BitConverter.ToInt32(bytes, 0);  // 0为字节数组开始转换的起始位置下标

int 转换为 byte数组

int num = 3;

byte[] bytes = BitConverter.GetBytes(num);  

原文地址:https://www.cnblogs.com/wynblogscc/p/13903071.html