title: Java BitSets writing to file
body: <p>I am working on Huffman Compression algorithm. I have the code for each character. For example
      f=1100<br/>
      d=111<br/>
      e=1101<br/>
      b=101<br/>
      c=100<br/>
      a=0<br/></p>
  
  <p>Now in order to achieve compression I need to write the codes as bits to a binary file. I am right now able to wrote them as bytes, which is doing nothing but increasing the size of compressed file. How do I write the codes as bits to binary file in Java?</p>