public void traverseTree(IHuffmanNode node, int[] word, int depth, HeaderInfo headerInfo) {
        //empty node
        if (node == null)
            return;

        //Node is leaf, attach code
        if (node.isLeaf()) {
            ((Word) node.getWord()).setOutputParam(
                    word,
                    depth);

            updateHeaderInfoForLeaf(
                    node.getWord(),
                    depth,
                    headerInfo);
            //Node is already a leaf (only one word in the whole chunk) - return!
            return;
            //Node is no leaf, recursive method call of @see generateHuffmanCode, to generate hoffman code for the branches
        } else {
            //Split level is reached
            if (Math.pow(2, depth + 1) == _branchTasks.size()) {
                //supply all TraverseTreeTask-Branches with a node to start traversing
                for (int i = 0; i < 2; i++) {
                    //first child of node
                    if (i == 0) {
                        //get empty branch
                        for (TraverseTreeTask task : _branchTasks) {
                            if (task.getBranchNode() == null) {
                                task.setParams(node.getLeft(),
                                        shiftWord(
                                                word.clone(),
                                                depth,
                                                0),
                                        depth + 1);
                                break;
                            }
                        }
                        //second child of node
                    } else {
                        //get empty branch
                        for (TraverseTreeTask task : _branchTasks) {
                            if (task.getBranchNode() == null) {
                                task.setParams(node.getRight(),
                                        shiftWord(
                                                word.clone(),
                                                depth,
                                                1),
                                        depth + 1);
                                break;
                            }
                        }
                    }

                }
                return;
            }
            //go to next level of the tree
            traverseTree(
                    node.getLeft(),
                    shiftWord(
                            word.clone(),
                            depth,
                            0),
                    depth + 1, headerInfo);
            traverseTree(node.getRight(),
                    shiftWord(
                            word.clone(),
                            depth,
                            1),
                    depth + 1
                    , headerInfo);
        }


    }