public void visit(int pos, int index, int total){
        if(index >= candidates.length || pos >= array.length) return;
        if(total < target) visit(pos, index+1, total);
        for(int i = 0; i < target / candidates[index]; i++){
            array[pos + i] = candidates[index];
            total += candidates[index];
            if(total == target){
            	ArrayList<Integer> item = new ArrayList<Integer>();
            	for(int j = 0; j <= pos + i; j++)
            		item.add(array[j]);
            	res.add(item);
            	return;
            } else if(total < target) {
            	visit(pos+i+1, index+1, total);
            } else
            	return;
        }
    }