help fixing bug in method to put secret message in image!
Hi so i need to create a method with these requirements:
putSecretMessageInImage - This method should put the length of the secret message (number of characters) inside the alpha channel of the very first pixel in the array. Note that messages may not be longer than 256 characters. Each character in the message should then be placed in each subsequent pixel's alpha channel. So, if you are to place the message "Help!", you would have to change the alpha data in the first 6 pixels. The first for the length and the next five for the characters. Note, you are changing the data inside the array.
and this is what i have :
public static void putSecretMessageInImage(int pixels,String message)
// ADD YOUR CODE HERE
int alpha = pixels;
alpha = alpha & 0xFFFFFF00;
int length = message.length();
alpha = alpha | length;
pixels = alpha;
for (int i=1;i<length;i++)
int index = (int) pixels[i];
char char1 = message.charAt(i);
index = char1 & 0xFFFFFF00;
It doesnt quite do the job however i think im really close..if someone could please help me figure out my mistake that would be greatly appreciated!