How do I convert an integer to unsigned 32 bit big endian byte array
问题 I have an integer which represents a frame length. I would like to know how I can convert the integer to an unsigned 32 bit (4 bytes) big endian byte array in Java 回答1: A big endian byte sequence is simply 'big numbers first'. But of course, converted into binary. So it's shockingly easy with almost any 'hex' conversion - that's the default output. It depends rather which language you're intending to use, but sprintf is pretty common. The format string to do this is %X so in perl you'd have