public static ArrayList<ArrayList<Integer>> threeSum(int[] numbers) {
        // write your code here
        int[]A=numbers;
        Arrays.sort(A);
        ArrayList<ArrayList<Integer>>rel=new ArrayList<>();
        for (int i=0,n=A.length;i<n;) {
            for (int j=i+1, k=n-1;j<k;) {
                int nj=j+1,nk=k-1;
                while (nj<k&&A[nj]==A[j])
                    ++nj;
                while (nk>j&&A[nk]==A[k])
                    --nk;
                int sum=A[i]+A[j]+A[k];
                if (sum==0) {
                    rel.add(new ArrayList<>(Arrays.asList(A[i],A[j],A[k])));
                    j=nj;
                    k=nk;
                } else if (sum<0)
                    j=nj;
                else 
                    k=nk;
            }
            int ni=i+1;
            while (ni<n&&A[ni]==A[i])
                ++ni;
            i=ni;
        }
        return rel;
    }