Implementation of Huffman algorithm in Java