Check the Java Language Spec... there no such thing as a "Bitwise unary NOT operator". There is bitwise complement operator, just like the previous poster already said.

ps You can also exclusive OR with a value of all 1 bits.

Edited
by JamesCherrill: Fixed UK spelling for bitwize (Thanks Tux) ;)

In Java ints are represented using 32 bits, so 15 is represented as 0000 0000 0000 0000 0000 0000 0000 1111, and the complement of that is 1111 1111 1111 1111 1111 1111 1111 0000

It's a bit difficult to explain why -16 is 1111 1111 1111 1111 1111 1111 1111 0000, but that is what it is. Perhaps it will help if you know that -1 is 1111 1111 1111 1111 1111 1111 1111 1111 and then you do -1 + -1 to get 1111 1111 1111 1111 1111 1111 1111 1110 which is -2, and you can keep on going until you get to -16. Try it and see.

Even though it looks like zero value is in the middle between positive and negative because the opposite of all-zero-bit is all-one-bit, it is not. Because 0 is (somewhat) being included in the positive side, there are 2^31 positive integer (0 up to (2^31)-1) and 2^31 negative integer (-1 up to -2^31) numbers. The first bit of the 32-bit is the sign bit.

Now, when you flip bits, it is not going to be exact as you think -- the flipped bit value of 15 is not -15. Below is value pairs from flipping bits. You can see that the pair is not perfectly matched to its own number but is off by 1.

Hello guys, hope you all fine,,
I have a problem when coding using python and opencv.
My project is to track the ball in model soccer pitch using raspberry pi ...