int s = S(8-i, (byte)(x&0x3F)); 

Specifically, what does x&0x3F mean?

    2 answers 2

    The operation is "bitwise and" between the variable "x" and the number 0x3F (63 in the decimal system)

      (byte) (x & 0x3F) - The right 6 bits of the variable x are "filtered". Since 0x3F is 00111111 in binary representation, the result of this operation will be 1 byte with 6 significant bits. For example, if x is of type int and has the value 11111111 111111111111111111111111, then (x & 0x3F) will return 00000000 00000000 00000000 00111111. Reduction to the byte will cut the left 24 bits and it will turn out 00111111.