mask = 0x80;
myVariable = 0;
for(int j = 0; j < 8; j++).{
If( myArray[j] == 1) myVariable |= mask;
mask = mask >> 1;
}
That assumes the most significant byte is in myArray[0] If not make mask = 1 and reverse the direction of the shift.
mask = 0x80;
myVariable = 0;
for(int j = 0; j < 8; j++).{
If( myArray[j] == 1) myVariable |= mask;
mask = mask >> 1;
}
That assumes the most significant byte is in myArray[0] If not make mask = 1 and reverse the direction of the shift.