C#里整型占用4字节长度,要用长度为4的字节数组存储,但要把一个小于16777215的整型存储到3个字节数组的快速方法可以采用如下方法: int a = 999999; int b = 0; //实现整数到3字节数组的转换 byte[] mytest = new byte[3]; mytest[0] = (byte)(a & 0xff); mytest[1] = (byte)((a>>8) & 0xff); mytest[2] = (byte)((a >> 16) & 0xff); //实现3字节数组到整数的转换 b = mytest[0] + (mytest[1] << 8) + (mytest[2] << 16);