@HKH13Serial.write only works with bytes, so to send larger values (int is 16 bit) you need to split them up into their components. The first 0xff is likely just for synchronisation and not essential. Then the higher 8 bits are sent by shifting them right until they fit into a byte, and finally the lower 8 bits. For example, let's say val = 1342 (that is actually too high, analogRead only returns values between 0 and 1023, but whatever). 1342 is 00000101 00111110 in binary. So the shift and truncation yields 00000101, and val & 0xff is just the lower byte 00111110 which can then be sent piece wise and reassembled on the other side.