public static boolean pathSumRootToLeaf(int sum, TreeNode root)
    {
        if(root == null)
            return sum == 0;
        else
        {
            int newSum = sum - Integer.parseInt(root.getValue());
            boolean leftPathSum = pathSumRootToLeaf(newSum, root.getLeft());
            boolean rightPathSum = pathSumRootToLeaf(newSum, root.getRight());

            return leftPathSum || rightPathSum;
        }
    }