我在我的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;
}
Run Code Online (Sandbox Code Playgroud)
有人可以给我提示如何将该方法转换为C++?