-2

Here is my code:

File file = new File("test.txt");                      
file.createNewFile();                                  
OutputStream outputStream = new FileOutputStream(file);
outputStream.write(65);                                
outputStream.write(66);                                
outputStream.flush();                                  
outputStream.close();

When I open test.txt in a Text editor I will see

AB

which are the UTF-8 characters with values 65 and 66.

I take a hex dump of the file and I see:

File Owner:             koraytugay
Group Owner:            staff
File Size:              2 Bytes
File Creation Date:     2014-11-04 13:18:45 +0000
File Modification Date: 2014-11-04 13:19:01 +0000

HEX DUMP:
[]   41 42                                               AB

So what is [] 41 42 supposed to mean here? Why not 65 and 66?

Koray Tugay
  • 22,894
  • 45
  • 188
  • 319

1 Answers1

3

The decimal number 65 is 41 hexadecimal.

The decimal number 66 is 42 hexadecimal.

Seelenvirtuose
  • 20,273
  • 6
  • 37
  • 66