How do you write any ASCII character to a file in Java?
<p>Basically I'm trying to use a BufferedWriter to write to a file using Java. The problem is, I'm actually doing some compression so I generate ints between 0 and 255, and I want to write the character who's ASCII value is equal to that int. When I try writing to the file, it writes many <code>?</code> characters, so when I read the file back in, it reads those as 63, which is clearly not what I want. Any ideas how I can fix this?</p>

<p>Example code:</p>

<pre><code>int a = generateCode(character); //a now has an int between 0 and 255
bw.write((char) a);
</code></pre>

<p>a is always between 0 and 255, but it sometimes writes '?'</p>
