论坛首页 入门技术论坛

int[]转换成 byte[]

浏览 3412 次
该帖已经被评为新手帖
作者 正文
   发表时间:2007-09-05  

 

      int []pHikHeader=new int[]{0x34,0x48,0x4B,0x48,0xFE,0xB3,0xD0,0xD6,0x08,0x03,0x04,0x20,0x00,0x00,0x00,0x00,0x03,0x10,0x01,0x10,0x01,0x10,0x10,0x00,0x80,0x3E,0x00,0x00,0x60,0x01,0x20,0x01,0x11,0x10,0x00,0x00,0x0E,0x00,0x00,0x00};
     像这个 int[]数组,怎么转换成 byte[]数组呢?

 

   发表时间:2007-09-05  
byte []pHikHeader=new byte[]{0x34,0x48,0x4B,0x48,0xFE,0xB3,0xD0,0xD6,0x08,0x03,0x04,0x20,0x00,0x00,0x00,0x00,0x03,0x10,0x01,0x10,0x01,0x10,0x10,0x00,0x80,0x3E,0x00,0x00,0x60,0x01,0x20,0x01,0x11,0x10,0x00,0x00,0x0E,0x00,0x00,0x00};

// 为什么这个声明会报错呢? 0xFE possible loss of precision,这里面值都是在byte范围内,没越过255.
0 请登录后投票
   发表时间:2007-09-05  
byte 的范围应该是-128~127吧.
0 请登录后投票
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics