Two's Complement is a process used to interpret the bits of an integer value so that both positive and negative values can be stored in the same range of bits without confusion.

This can't be explained without step-by-step examples, so let's dive in, eh? I'll take it easy on you and just use single-byte integers (that's 8 bits).

First, some simple binary, just to make sure the explanation is thorough. Each digit (either 0 or 1) represents a power of 2. The right-most digit is that digit times 2^{0}, the next digit is that digit times 2^{1}, and so on. Therefore:

```
00000001 = 1
```

00000010 = 2

00000011 = 2 + 1 = 3

00010110 = 16 + 4 + 2 = 22

00101010 = 32 + 8 + 2 = 42

11111111 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255

This example is for what is called an unsigned integer, because it can't store negative values, only the positive range 0 to 255.

So what if we want to store negative values? That's where Two's Complement comes in. The idea was that in signed integers (that can store both positive and negative integers), the left-most bit signifies a positive value if it is 0, and a negative value if it is 1.

The highest positive value is then 01111111 (127), and the lowest value is 10000000 (-128). How does this work? I'll show you:

```
10010010 Here's the actual stored byte
```

01101101 First, we flip every bit

00000001 Then you add 1 to it, and get

01101110 This is 110, but we're dealing with a negative, so it's interpreted to -110

The same process is used to interpret a negative value into the stored binary value, like this:

```
00101010 Is 42, but we want to store -42, so we start with the plain positive value
```

11010101 We then flip it

00000001 And add 1, and get

11010110 And this is the final stored result of -42

So that's the basics of Two's Complement. Another bit of trivia is that signed integers, if you keep adding 1 (binarily), will rotate. You can start with 0, and work you way up to 127, but as soon as you add again, 01111111 rolls over to 10000000 (-128). Adding one again gives you 10000001 (-127), and then you're working your way up through the negative values to 11111111 (-1). Since the number of bits is limited, and doesn't increase. Adding 1 again doesn't give us a 9-bit value of 100000000, but is truncated to 8-bits and we get 00000000, which of course is 0.