File contaning ÿ symbol while saving text file as binary data
<p>I am saving .txt file as a binary format.But at the last line of a binary file,one more character is saved i.e  ÿ</p>

<p>Why this has happened ?
My code is like this :</p>

<pre><code>FileOutputStream fout = null;
InputStream fin;
String path="something";
int i = 0;
fout = new FileOutputStream(path);
do {
  i=fin.read();
  fout.write(i);
} while(i != -1);
fout.flush();
fout.close();
</code></pre>
