Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to convert integer (int) into long? For example, how much is int 9 converted into ***L?
How to convert integer (int) into long? For example, how much is int 9 converted into ***L?
For the conversion between data, according to a law: the length is shortened, the high bits are truncated, the short ones are lengthened, and the high bits are supplemented by 0 or 1:

Whether to supplement 0 or 1 depends on whether the converted number is negative. If it is negative, it will be supplemented by 1, and if it is non-negative, it will be supplemented by 0.

For example, if an integer is two bytes long and an integer is four bytes long, when-1 is converted into an integer, it is11111. 16th bit) becomes111111/kloc-0. 0 1 (two bytes with 16 zeros)1111111.