Huffman encoder and decoder implemented in java