public List<List<Integer>> fourSum(int[] num, int target) {
        List<List<Integer>> result = new ArrayList<List<Integer>>();
        Arrays.sort(num);
        int length = num.length;
        for (int i=0;i < length-3 ;i++ ){
            for (int j =i+1; j < length-2 ;j++ ){
                for (int m = j+1, n = length -1; m < n ; ) {
                    int val = num[i] + num[j] + num[n] + num[m];
                    if(val > target)
                        n--;
                    else if(val < target)
                        m++;
                    else{
                        List<Integer> intList = new ArrayList<Integer>();
                        intList.add(num[i]);
                        intList.add(num[j]);
                        intList.add(num[m]);
                        intList.add(num[n]);
                        if(!result.contains(intList))
                            result.add(intList);
                        m++;
                    }
                }
            }
        }
        return result;
    }