I can\'t google the ~ operator to find out more about it. Can someone please explain to me in simple words what it is for and how to use it?
~ is a bitwise NOT operator. It will invert the bits that make up the value of the stored variable.
http://en.wikipedia.org/wiki/Bitwise_operations_in_C#Bitwise_NOT_.22.7E.22_.2F_one.27s_complement_.28unary.29