public static byte[] int2Byte(int intValue)
  {
    byte[] b = new byte[4];
    for (int i = 0; i < 4; i++) {
      b[i] = (byte)(intValue >> 8 * (3 - i) & 0xFF);
    }    return b;
  }

解决方案 »

  1.   

    intValue  向右位运算 (byte)(intValue >> 8 * (3 - i) & 0xFF);intValue 向右移 3 2 1 0位
    分别为 0001
    0010
    0100
    1000
      

  2.   

    >>  向右位运算符 (byte)(intValue >> 8 * (3 - i) & 0xFF);intValue 向右移 3 2 1 0位
    结果分别为 (二进制作):
    0001
    0010
    0100
    1000
      

  3.   

    位移运算(二进制)
    >> n 右移n位,最高位符号位不移 
    << n 左移n位,最高位符号位不移
    >>> n 右移n位,最高为符号位也移
    <<< n 左移n位,最高为符号位也移