title: java output hex (ByteArrayOutputStream)
body: <p>I have :</p>
  
  <pre><code>ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
  encoder.encode(question, outputStream);
  </code></pre>
  
  <p>and when <code>System.out.println(outputStream)</code> prints this .. i see <code>0►☻☺♣▬♂test some</code> and I want to see this in HEX like <code>30 04 12 54 33</code></p>
  
  <p>How can I do that ?</p>
  
  <p>Thanks</p>
  
  <p>I was able to write the binary to a file like this :</p>
  
  <pre><code>File file = new File("out.bin");
  FileOutputStream filename = new FileOutputStream(file);
  outputStream.writeTo(filename);
  </code></pre>