title: How do I represent an LZW output in bytes?
body: <p>I found an implementation of the LZW algorithm and I was wondering how can I represent its output, which is an int list, to a byte array.</p>
  
  <p>I had tried with one byte but in case of long inputs the dictionary has more than 256 entries and thus I cannot convert.</p>
  
  <p>Then I tried to add an extra byte to indicate how many bytes are used to store the values, but in this case I have to use 2 bytes for each value, which doesn't compress enough.</p>
  
  <p>How can I optimize this?</p>