Reading from a File

In the file frank.tif there is a message hidden in it. In hiding the message the first 80 bytes of the file are skipped. The hidden message is a text message. I need to be able to extract the message but I can't seem to get my coding to work correctly. Could someone please give me some suggestions as to what needs to be done to get the correct answer/output.

import java.io.*;

publicclass Frank

{

publicstaticvoid main(String[]args)

{

byte letters;

byte letter;

int countit=0;

try

{

DataInputStream file=new DataInputStream(new FileInputStream("frank.tif"));

file.skip(80);

do

{

letters=(byte)file.read();

int bit=letters & 0x01;

letter=(byte)(letters<<1);

letter |= bit;

countit++;

if(countit==8)

{

System.out.print(String.valueOf(letter)+"");

countit=0;

}

}

while(letters!=-1);

}

catch(IOException e)

{

System.out.println(e);

}

}

}

[2044 byte] By [buffer_88a] at [2007-9-29 15:26:14]
# 1

What do you want to do with this part of your code.

int bit=letters & 0x01;// bit is 0 or 1

letter=(byte)(letters<<1); // the left most bit of letter is 0

letter |= bit; // letter = bit

I think the correct version would be

letters =(byte)(letters<<1);

letter = letters | bit;

Andi_Berlina at 2007-7-15 13:18:05 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 2
That's what I want to do, Thank You, but is there a way that these numbers are supposed to display a text message or am I totally wrong.
buffer_88a at 2007-7-15 13:18:05 > top of Java-index,Archived Forums,New To Java Technology Archive...