| Author |
Reading binary from a file and converting to CHAR
|
John Gable
Greenhorn
Joined: Apr 12, 2004
Posts: 11
|
|
Hi, I'm trying to read binary from a text file into java - I want to read 8 bits and then convert that to a CHAR. This is my code: The problem I have is it's reading in as a number. This is my output: going to decrypt value of answer b4 parsing: 0 value of answer: 17 inside decrypt for printb this is the output: ◄ value of answer b4 parsing: 17 value of answer: 14 inside decrypt for printb this is the output: ♫ basically I want value of answer b4 parsing to be : 00001111 (as a string) value of answer: 00001111 (but as a int not a string) because i pipe that into a decryption algoritm that takes the 8 bits and decrypts then i can convert back to char. Any help would be much appreciated.
|
 |
Keith Lynn
Ranch Hand
Joined: Feb 07, 2005
Posts: 2341
|
|
|
I don't see where answer is defined.
|
 |
John Gable
Greenhorn
Joined: Apr 12, 2004
Posts: 11
|
|
Answer is defined at the beginning of the method. int answer = 0;
|
 |
 |
|
|
subject: Reading binary from a file and converting to CHAR
|
|
|