第1个回答 推荐于2018-04-12
byte[] b = {3,2,1,9};
String s = new String(b,"UTF8");现将4字节转为一个String s
Integer.parseInt(s),将String转为Integer num,
String.valueOf(num), 将Integer num 转为String
string 转 byte[]
byte[] b= s.getBytes("UTF8");本回答被网友采纳
第2个回答 2013-11-09
byte bytes []= {22, 22, 22, 22};
int a = bytes[0]<<24+bytes[1]<<16+bytes[2]<<8+bytes[3];
byte bytes2[]=new byte[4];
bytes[0]=(byte)(a>>24);
bytes[1]=(byte)((a>>16)&0xff);
bytes[2]=(byte)((a>>8)&0xff);
bytes[3]=(byte)(a&0xff);
上面是例子,避免一下溢出就行了