title: Code to write OutputStream into a file
body: <p>I need to write some output into a file using Java. Currently my code is writing the OutputStream on system console. My concern is I have to write <code>process.getOutputStream()</code> output which returns an OutputStream instance.</p>
  
  <pre><code>final PrintWriter writer = new PrintWriter(process.getOutputStream());
  writer.println(200);
  writer.close();
  </code></pre>