question

Given a 32-bit unsigned integer, encode the integer into multi-bytes array, where each of the byte contains only 7 bits of the integer. To indicate there is more byte follow, the most significant bit of the byte is set to 1, else it is set to 0. Finally, return the array to the caller. For example, the value 5 would be encoded as 1 byte as 0x05, 128 would be encoded as two bytes as 0x81 0x00, and so on. Write a function to implement above requirement.

你可能感兴趣的:(IO)