I have some python code need to phase to java,
python code :
>>> struct.pack('h', 19)
b'\x13\x00'
I want to know how it phase to java, thanks~
I have some python code need to phase to java,
python code :
>>> struct.pack('h', 19)
b'\x13\x00'
I want to know how it phase to java, thanks~
Use a DataOutputStream
with a ByteArrayOutputStram
For example:
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream d = new DataOutputStream(b);
d.writeShort(19);
byte[] result = b.toByteArray();