7 segment LED

6 = 4 + 2 = (2^2) + (2^1) = 1 * (2^2) + 1 * (2^1) + 0 * (2^0)
6 in binary is 110.
The numbers are as follows:
0 = 0000
1 = 0001
2 = 0010
3 = 0011
4 = 0100
5 = 0101
6 = 0110
7 = 0111
8 = 1000
9 = 1001

The computer stores the numbers in this format and the LED segment seems to want them in this format.
That makes it very easy to directly output them:

int number = 6; // Number we want to output
digitalWrite(A, number & 1);
digitalWrite(B, (number >> 1) & 1);
digitalWrite(C, (number >> 2) & 1);
digitalWrite(D, (number >> 3) & 1);

Analysis:

number & 1

This calculates the bitwise AND of number and 1
number is 0110 and 1 is 0001
0110 & 0001 = 0000 = LOW
In the arduino library LOW is the same as 0, so we can directly put the result into digitalWrite

digitalWrite(B, (number >> 1) & 1)

This time, before we compare number to 1, we shift it right 1 bit.
0110 becomes
0011
Then we check the last bit again:
0011 & 0001 = 0001 = HIGH
Again we can put the result directly into digitalWrite, because 1 is recognized as HIGH.

For your segment you want to split a number into its individual bits, and put them onto differnt pins.

(number >> bit) & 1

does this, it shifts the number right, so that the bit you are interessted in is the lowest one, and then int sets everything else to 0, so that only the lowest bit determines, if the result is 0 or 1.

Hope this helped, you might also want to look into: