int转成byte数组:
int value = 12343;
byte[] b = new byte[4];b[0] = (byte)(v);
b[1] = (byte)(v>>8);
b[2] = (byte)(v>>16);
b[3] = (byte)(v>>24);byte数组转成int:int v = bytes[0]*0x1000+bytes[1]*0x100+bytes[2]*0x10+bytes[3];

解决方案 »

  1.   

    byte[] b = BitConverter.GetBytes(
       0xba5eba11 ); 
    //{0x11,0xba,0x5e,0xba}
    uint u = BitConverter.ToUInt32(
       new byte[] {0xfe, 0x5a, 0x11, 
       0xfa},0 ); // 0xfa115afe 
      

  2.   

    b = new byte[] {0xfe,0x5a,0x11,0xfa};
    u = (uint)(b[0] | b[1] << 8 |
       b[2] << 16 | b[3] << 24);
    b[0] = (byte)(u);
    b[1] = (byte)(u >> 8);
    b[2] = (byte)(u >> 16);
    b[3] = (byte)(u >> 24);
      

  3.   

    http://www.fawcette.com/China/XmlFile.aspx?ID=259
      

  4.   

    BitConverter.GetBytes
     
    BitConverter.ToUInt32
    我几个月前为这个问题花了一百多分。