Concatenating Integer variables

It seems to me that you are complicating things.

From your description the encoder has 4 outputs so let's label them from 0 to 3. If you read the state of each output and set the equivalent bit of a byte variable and test the value of the byte variable, then in the case of your 2 examples you would be in position 2 when the byte value was 2 and in position 8 when the byte value was 8.

However, 2 examples is not much to go on. What does the strobe pin do ?