public static int kthLargestElement(int k, List<Integer> numbers) {
        // write your code here
        List<Integer>A=numbers;
        while (true) {
        	int n=A.size();
        	List<Integer> mid=new ArrayList<>();
            for (int i=0;i<n;i+=4) {
                if (i+4<=n) {
                    Collections.sort(A.subList(i,i+4));
                    mid.add(A.get(i+2));
                } else {
                    Collections.sort(A.subList(i,n));
                    mid.add(A.get(i+(n-i)/2));
                }
            }
            int pivot;
            if (mid.size()==1)
                pivot=mid.get(0);
            else 
            	pivot=kthLargestElement((mid.size()+1)/2, mid);
            int p;
            for (p=0; p<n;++p) {
                if (A.get(p)==pivot)
                    break;
            }
            Collections.swap(A,0,p);
            p=1;
            for (int l=1, r=n-1, i=1;i<=r;p=l) {
                if (A.get(i)<=pivot) {
                    Collections.swap(A,i++,l++);
                } else {
                    Collections.swap(A,i,r--);
                }
            }
            Collections.swap(A,0,--p);
            if (n-p==k) {
                return pivot;
            } else if (n-p>k) {
                A=A.subList(p+1,n);
            } else {
                A=A.subList(0,p);
                k-=n-p;
            }
        }
    }