translating shifts from Java (Processing) to C++ (arduino)

robvoi:
Maybe there some explanation on what has to be achived by the code helps:

I have two bytes as RGB value: RRRRRGGG GGGBBBBB. At least that's what I expect to get from the camera. (If I would fully understand what the processing code does, I would be sure :slight_smile: )

I want to seperate them into three integers.
int 1= RRRRR
int 2= GGGGG
int 3= BBBBB

Yes, that is what the Processing code seems to do. The >>> operator is the Java unsigned bit shift operator - when you do an unsigned bit shift, the bits shifted into the most significant position are zero. The code seems to extract three 5-bit values from the 16 bits. The code to extract the g (green) channel is a bit more complicated that the other channels because it has to take three bits from one byte and two bits from the other.