title: how to convert file into binary using java
body: <pre><code>try
  {
      FileInputStream fis=new FileInputStream(new File("Binary.txt"));
      byte[] infoBin=new byte[fis.available()];
      fis.read(infoBin);
      for (byte b : infoBin)
      {
          String bin=Integer.toBinaryString(b);
      }
  }
  </code></pre>
  
  <p>How to read a file and convert that file contents into binary then write the binary to a new file using java</p>
  
  <p>After Binary conversion, i don't know  how to write the string bin into the new file ?</p>