A cast will always work, but if the number is too big, it will get cut off. By casting something you are telling the compiler, I know that this is dangerous because I am going from a larger value down to a smaller value, but trust me, I know what I am doing.
For example if you have this:
The output will be -2
This has to do with the bit representation. The 32 bits for the int 254 will be cut down to 8 bits for a byte. The 24 high level bits will be lost, and what remains is the bit
pattern for -2.
Bill