This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
The character to be written is contained in the 16 low-order bits of the given integer value; the 16 high-order bits are ignored.
So it's treating the lower 16 bits of yuor random integer as a Unicode character and writing that. It may be that it can tell the character is invalid; who knows?
The main description for BufferedWriter has a good suggestion: wrap it in a PrintWriter:Now you can use println(int) to write each integer on a line. This writes them as text rather than the bytes as they are stored in memory. If you want to write them as raw bytes (non-human-readable) then use a DataOutputStream wrapped around a FileOutputSteram (BufferedOutputStream inbetween to mirror what you have).
The JavaDocs are your friend. Get to know them well.