我在我的java代码中有这个方法,它返回给定int的字节数组:
private static byte[] intToBytes(int paramInt)
{
byte[] arrayOfByte = new byte[4];
ByteBuffer localByteBuffer = ByteBuffer.allocate(4);
localByteBuffer.putInt(paramInt);
for (int i = 0; i < 4; i++)
arrayOfByte[(3 - i)] = localByteBuffer.array()[i];
return arrayOfByte;
}
有人能给我一些提示吗?我怎样才能把这个方法转换成C++?
https://stackoverflow.com/questions/5585532
复制相似问题