Bitwise Inverse?

if pinMask = 0x1e (0001 1110) How do i get the inverse? ie (1110 0001)

pinMask = ~pinMask; //is this correct

Yes