When different types of data are converted, the low-level is copied to the object,
For example, long to int is the lower 32 bits to int, so that if the high 32 bits have data, then the data of that part is lost.
If int to long, it is int 32 bit to long of low 32 bits, high 0, such as int is negative, then high 32 is the highest bit 1, the remaining complement 0;
after a long is converted to int, is the data in int a long 32-bit or a low 32-bit?
So, int to unsigned int is to give the 32 bits of int directly to unsigned int.
In other words, give the bit to each other.
As for the output of what results, there is a system more type judgment.
Instance:
The binary representation method of the int-1 is 11111111111111111111111111111111, because it is of type int, so the system will be judged as-1;
The binary representation of unsigned int 4294967295 is also 11111111111111111111111111111111, because it is the unsigned int type, so the system will be judged to be 4294967295;
Conclusion:
In the final analysis, the data type behaves as binary at the bottom. For example, int has 32 bit, and long has 64 bit.
When it comes to Java and C type conversions, the number of bits in the data type is a concern.
You can match Java's uint8_t of Byte and C; (typedef unsigned char uint8_t).
Although the Java byte is signed, and the uint8_t is unsigned, but there is no relationship, the second binary notation is the same, it is necessary to note that when parsing the data, know that there is a difference, the attention point, there is no problem.
Understanding of data transformations