I can do this in Java
final byte[] b = new byte[]{0x01, 0x02, 0x04, 0x08,
(byte)0x80, 0x40, 0x20, (byte)0xff,
(byte)0xef, 0x40, 0x30, (byte)0xfe,
0x3f, (byte)0x90, 0x44, 0x78};
whereas in Python 2.x I can just use
b = '\x01\x02\x04\x08\x80\x40\x20\xff\xef\x40\x30\xfe\x3f\x90\x44\x78'
The Java syntax is a pain and needs (byte)
casts to handle values with most significant bit set.
Is there an easier way? (aside from writing a helper class to turn a string like "01020408804020ffef4030fe3f904478"
into a byte[]
)