code: public int getEncodedLength(byte[] data) {
      if (data == null) {
        throw new NullPointerException("data");
      }
      long len = 0;
      for (byte b : data) {
        len += lengths[b & 0xFF];
      }
      return (int)((len + 7) >> 3);
    }
docs: Returns the number of bytes required to Huffman encode the input string literal.
  @param  data the string literal to be Huffman encoded
  @return the number of bytes required to Huffman encode <code>data</code>