Please use the code button; I have edited your post so you can see how much easier it is to read. You are not getting nonsense; when I edited your post I saw the squares had turned to tiny boxes which look like what I have called code, only smaller.That means you have put 0x0002 into your file, and 0x0002 is a control character. What it actually is, you can work out by looking for "basic Latin" or similar in Unicode. If you pass 2 you get 0x0002. Try running your app with 65 66 67 68 and see whether you get the same as 0x41 0x42 0x43 and 0x44 (same Unicode chart).
What is happening is that you are writing the numbers in binary rather than in text. You need to go through the classes you are using and see whether you are writing binary or text, and whether you should be using different classes. There is more about writing to files etc in the Java Tutorials; I think you want to write a "character stream."