TA贡献1725条经验 获得超7个赞
publicstaticshortbyteArray2short(byte[] b,intindex) { return(short) (((b[index +1] <<8) | b[index +0] &0xff)); } byte[]和char的互转 /** * 字符到字节转换 * * @param ch * @return */ publicstaticvoidchar2byteArray(byte[] bb,charch,intindex) { inttemp = (int) ch; //...
如果涉及 big_endian 和 little_endian 变化,则互换两个字节即可
short A[10]; memcpy( B, A, 20 ); 5. 6. 7. 8.
char *p = new char[100];unsigned char *pU = static_cast(p);