```
/**
* Definition for binary tree
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
public class Solution {
public LinkedList<LinkedList<Integer>> pathSum(TreeNode root, int sum) {
LinkedList<Integer> list = new LinkedList<Integer>();
LinkedList<LinkedList<Integer>> bigList = new LinkedList<LinkedList<Integer>>();
get(root,sum,0,list,bigList);
return bigList;
}
public void get(TreeNode node, int target, int sum, LinkedList<Integer> list, LinkedList<LinkedList<Integer>> bigList){
if (node == null) return;
int number = sum + node.val;
if (number == target && node.left == null && node.right == null){// leaf & target check
list.add(node.val);//add it to list
bigList.add(list);//add list to big list
return;
}
else {
list.add(node.val);
//recurse
if (node.left != null) get(node.left, target, number, list, bigList);
if (node.right != null) get(node.right, target, number, list, bigList);
}
}
}
```

For the test case:

[1,1,#,1,#...,1,#,1] 1000"