BinaryNode lt = new BinaryNode(theQueue.poll()); BinaryNode rt = new BinaryNode(theQueue.poll()); BinaryNode newNode = new BinaryNode(new HuffmanData((lt.freq + rt.freq),"*"),lt,rt); theQueue.add(newNode);