日期:2014-05-20 浏览次数:20726 次
public static byte[] getByte(int a) { byte[] bs = new byte[4]; bs[0] = (byte)((a >> 24) & 0xff); bs[1] = (byte)((a >> 16) & 0xff); bs[2] = (byte)((a >> 8) & 0xff); bs[3] = (byte)((a) & 0xff); return bs; }
------解决方案--------------------
int i = 88;
String i16 = Integer.toHexString(i);
byte[] buf = i16.getBytes();
for(int j = 0;j < buf.length;j++){
System.out.println(buf[j]);
}
------解决方案--------------------
public static byte[] getByte(int a) { byte[] bs = new byte[4]; bs[0] = (byte)((a >> 24) & 0xff); bs[1] = (byte)((a >> 16) & 0xff); bs[2] = (byte)((a >> 8) & 0xff); bs[3] = (byte)((a) & 0xff); return bs; }
------解决方案--------------------