0C 1C 34 38 34 24 12 1C 24 10 1B 0E 0A 1D 25
C S 2 6 2 I S G R E A T !
Translating the above message into individal 8-bit bytes, we get:
00001100 00011100 00110100 00111000 00110100 00100100 00010010 00011100 00100100 00010000 00011011 00001110 00001010 00011101 00100101
Since we are going to only use six bits per character, we can remove the two Most Significant Bits (MSBs) with the following result:
001100 011100 110100 111000 110100 100100 010010 011100 100100 010000 011011 001110 001010 011101 100101
Now comes the tricky part... We will pack the bits into 8-bit bytes. These bytes will be part of our Packed Array. To do this, we start at the Least Significant Bit (LSB) of the first character. In this case, it is the letter C with the bit pattern 001100. The LSB of this pattern is the last 0 (bolded) - 001100. This bit will become the lsb of the first element in the packed array. We continue, bit by bit, until we have put the entire character in the first element of the packed array. Note that there will be two bits that are not yet initialized: - - 0 0 1 1 0 0 <- PackedArray[0] (started)
Now we start on the next character, or 011100 (The letter 'S'). Starting at the LSB, we put that bit in the next available bit of PackedArray[0]: - 0 0 0 1 1 0 0, then the next LSB after that: 0 0 0 0 1 1 0 0, and we have finished the first element of PackedArray. However, we have not finished packing the letter 'S'! We still have four bits left to encode! So, those four bits will then become the least significant bits of the next element of PackedArray:
- 0 1 1 1 <- PackedArray[1] (started)
Continuing with the third character (the character '2'), we take the four LSBs of that character, and add them to the remaining bit locations:
0 1 0 0 0 1 1 1 <- PackedArray[1] (completed)
I’m having trouble to understand how fill in the bits with the LSB to shrink the numbers of bits