I have an int array int[] stegoBitsArray = {0,1,1,0,1,1,0,0,0,1,1,0,0,0,0,1...}
I want each 8 bits converted to byte and added to byte array which i would later convert to char array because 01101100 is letter "l" and so on so ... So i tried using ByteBuffer but it throws me BufferOverflowException here's my code snippet:
int[] stegoBitsArray = getStegoTextFromImage(stegoImage);
ByteBuffer byteBuffer = ByteBuffer.allocate(stegoBitsArray.length);
for (int i = 0; i < stegoBitsArray.length; i++) {
byteBuffer.putInt(stegoBitsArray[i]);
}
Or it's more better to convert from int array to characters?