[RESOLVED] 2D Array

From a mathamatical point of view you have a function that maps from a boolean array to a byte array. Let's assume that the second dimension is one (that makes it easier for the moment).

The first eight entries (0..7) in the boolean array map to the first byte in the byte array.
The second eight entries (8..15) in the boolean array map to the second byte in the byte array.

See something?
Let's display it in a table:
Boolean Array (b) | Byte Array (x) / position in byte (y)
0 | 0 / 0
1 | 0 / 1
...
7 | 0 / 7
8 | 1 / 0
9 | 1 / 1
...
15 | 1 / 7
... and so on.

So the question is how to get to values with drawing such a table for every possible value?
You can compute x simply as

x = (int) (b / 8);

Example: 15 / 8 = 1.875, which will be cut off to 1 because of the integer cast.
OK, let's go to the position (y). As you can see the positions always counts up to seven and starts than from zero again. This looks very much like the result from a modolo operation:

y = b % 8

Example: 15 % 8 = 7.

With this in mind you can get your values out of the byte array. But keep in mind that you might need a bit mask together with the >>-operator.

Example: 0b11001100 is stored in myByteArray[1][1]. To retrieve position no. 3 you need a bitmask like 0b00000100.
(myByteArray[1][1] & 0b00000100) >> 3; => returns 1; Can you see why? You have to fileter the other values out before left shifting, or do it after, but if xou don't do it the result would be 0b00011001, which is not the flag that you want.