0xFF = 00000000000000000000000011111111
That represents a byte 0xFF is full complement bit (data) 1, -1.
And the data values are two different concepts. Value indicates the size of a number, and the data is the complement (as is present in the computer's complement form).
byte b = -1; // in the computer that the actual data values (i.e., complement) 11111111
int A = B & 0xFF; // 11111111 = 11111111 & 11111111 00000 ...., and to look into its complement code, the compiler will convert this to binary to decimal output, a = 255
and:
byte b=-1;
int a = b = -1 = 11111111111111111111111111111111;
The former data remains unchanged, the value -1 into a 255;
The latter remains unchanged numerical data from 11111111 becomes 1111111111111111111111111 .. . . .
We generally do little for basic data types turn up the basic data types. For example, we need serialization and de-serialization of data int