标签:
引用 http://anjun.cc/post/651.html
private byte[] intToByteArray(final int integer) throws IOException {
// ByteArrayOutputStream bos = new ByteArrayOutputStream();
// DataOutputStream dos = new DataOutputStream(bos);
// dos.writeInt(integer);
// dos.flush();
// return bos.toByteArray();
byte[] result = new byte[4];
result[0] = (byte) (integer >> 24 & 0xff);
result[1] = (byte) (integer >> 16 & 0xff);
result[2] = (byte) (integer >> 8 & 0xff);
result[3] = (byte) (integer & 0xff);
return result;
}
标签:
原文地址:http://www.cnblogs.com/anjuncc/p/4658873.html