It help to reduce lot of codes. It is occasionally used in RGB values which consist of 8bits.
where 0xff means 24(0's ) and 8(1's) like 00000000 00000000 00000000 11111111
It effectively masks the variable so it leaves only the value in the last 8 bits, and ignores all the rest of the bits
It’s seen most in cases like when trying to transform color values from a special format to standard RGB values (which is 8 bits long).