BufferedWriter.write(int) is meant to write a single charecter, not a integer.
public void write(int c)
throws IOException

Writes a single character.

Overrides: write in class Writer
Parameters:c – int specifying a character to be written
Throws:IOException – If an I/O error occurs

So to write integer in file, use one of the following

  • wr.write(“123”);
  • wr.write(new Integer(123).toString());
  • wr.write( String.valueOf(123));

123 = 0x7b = ascii code for {, so you are writing the character to the file by below code