First of all I read many about this question. However none of them was my solution. I am trying to read string from console and write it to the .txt as byte.
I tried FileWriter/BurfferWriter. But ,for example, I am typing "abcd" from console, then I made it as byte[]. And in the for loop I wrote it in the txt file. These seems OK. However, when I looked at the txt file, I saw that it was written as normal, "abcd". I was expecting it to be writen something like http://s24.postimg.org/uid0tt0g5/byte.png I do not want any one to read my .txt file when s/he opens it.
Then, I tried to RandomAccessFile. At this time, I coded something like that:
for(int i=0; i<tableName.length(); i++){
file.writeChar(tableName.charAt(i));
}
however at this time, it writes the abcd as http://s14.postimg.org/j1k26qqnx/byte2.png As you see, a b c d is between the bytes. And normally, abcd is only 4 bytes, and when I wrote it in the .txt, txt file becomes 8 bytes.
This is the problem. I do not want to see any char in the txt file.
What is the solution? Thank you