It's not a school question, that's just for fun.
Imagine I have a Byte array with a length of 2 :
array[0] = 01010101
array[1] = 11110000
I want to take array[0] and transform it into another array of length 4 :
divArray[] = {01000000, 00010000, 00000100, 00000001}
To be more precise, I have a .bmp file that I read like a DataStream, and I want to "hide" a message in it, To do it I need to transform each character of my message in bytes (according to the ASCII table) then split them into 4 pieces of 2 bits. Then I'll replace the two last bits of the bytes in the picture with the ones from the message.
ex : My picture is '00110011 11001100 10101010 01010101'
My message is "a", which is 97 in ASCII table and '01 10 00 01' in binary.
The modified picture with the message will be : '00110001 11001110 10101000 01010101
I know how to read the file, how to replace the two last bits, how to rewrite the file, but my only problem is how to split the message into pieces of 2 bits.