title: Buffered Writer occasionally creates symbols rather than numbers
body: <p>So I have a program that collects a bunch of data and continuously concatenates the data into a string with a single white space between each entry.  During my close routine I print the String into a txt file using buffered writer. About 50% of the time the data shows up as (mostly) Chinese symbols.  Is the VM doing some weird Unicode stuff? Why does this only occur sometimes?</p>
  
  <p>I've looked around on other forums and have not seen other instances of this problem.  None of the other CS majors I know understand what is happening.</p>
  
  <p>EDIT : the data is all integer numbers ranging 0-1365;</p>
  
  <p>UPDATE: upon further research I found <a href="https://stackoverflow.com/questions/38779757/buffered-writer-now-writing-to-file?rq=1">this</a> which makes me think a may need a PrintStream rather than a BufferedWriter can anyone speak to that? I tested the PrintStream and I will not be able to construct it with a FileWriter as I would a BufferedWriter which means I need more research to write to my txt.</p>
  
  <p>UPDATE: printing to the console does not make this error occur. I will accept an answer that explains way Notepad (the program I am using to open the txt) sometimes displays numbers and sometimes displays symbols.</p>
  
  <p>Here is the relevant code:</p>
  
  <pre><code> //fields
  private static BufferedWriter out;
  private File saveFile;
  String data;
   //inside constructor 
  this.saveFile = new File("C:\\Users\\HPlaptop\\Desktop\\MouseData.txt");
                  this.saveFile.delete();
                  try{this.saveFile.createNewFile();}
                  catch (IOException e ){System.out.println("File creation error");}
  try {out = new BufferedWriter(new FileWriter("C:\\Users\\HPlaptop\\Desktop\\MouseData.txt"));}
                  catch (IOException e) {System.out.println("IO Error");}
                  this.control.addWindowListener(new WindowAdapter()
                  {
                   public void windowClosing(WindowEvent e)
                      { //there is a method call here but the basics are below
                          out.write(data);
                      out.close();
                          System.exit(0);
                      }
                  });
  </code></pre>
  
  <p>Here is an example data set printed correctly:</p>
  
  <pre><code> 1365 767 1365 767 1365 767 1364 767 1353 756 1268 692 1114 604 980 488 812 334 744 283 694 244 593 150 473 81 328 13 207 0 124 0 115 0 102 0 99 6 107 13 132 20 173 32 187 31 190 25 194 20 201 17 215 14 221 10 224 7 224 7 224 7 226 6 226 6 226 6 226 6 226 6 226 6 226 6
  </code></pre>
  
  <p>This data set was taken seconds later and is not what I want</p>
  
  <pre><code>㐀ㄹ㈠㤰㐠㔸㈠㈱㐠㠶㈠㐱㐠㘲㈠㘰㌠㠷ㄠ㔹㌠㌳ㄠ㌹㈠㘹㈠㄰㈠㠷㈠㜳㈠㐶㈠㐷㈠㐶㈠㔷㈠㌶㈠㔵㈠㐵㈠㠰㈠㤴ㄠ㔲㈠㤴㐠‶㐲‹㌱㈠㘴〠㈠㘴〠㈠㘴〠㈠㜴〠㈠㠴〠㈠㠴〠㈠㜴㠠㈠㔴ㄠ‶㐲‵㤱㈠㔴ㄠ‹㐲‵㠱㈠㜴ㄠ‶㐲‹ㄱ㈠〵ㄠ‰㔲‰〱
  </code></pre>