converting bits in to integer
问题 I receive a datapacket containing a byte array and I have to get some integer values from it. Here is a part of the documentation. Can someone help me please? This comes in a 4-byte array. Year from 1990 to 2052 (6 bit), Month from 1 to 12 (4 bit), Day from 1 to 31 (5 bit), Hour from 0 to 23 (5 bit), Minute from 0 to 59 (6 bit), Second from 0 to 59 (6 bit) Default value: 1 January 2000, 12:00:00 The format of the message is in little endian. 回答1: What you need is some bitwise operations.