public static <E> void topKSort(E[] array, Comparator<E> comparator, int k) {
    	if(k>=array.length){
    		k = array.length;
    	}
    	if(k<0){
    		throw new UnsupportedOperationException("-k <number> number must be equal or greater than zero.");
    	}
    		//k is less than or equal array.length
    	FourHeap<E> fh = new FourHeap<E>(comparator);
   		int i = 0;
   		while(i<k){
   			fh.insert(array[i++]);
   		}
   		if(k!=0){
   			while(i<array.length){
   				if(comparator.compare(fh.findMin(),array[i])<0){
   				fh.deleteMin();
    				fh.insert(array[i]);
   				}
   				i++;
   			}
   		}
   		int v = k-1;
   		while(!fh.isEmpty()){
   			array[v] = fh.deleteMin();
   			v--;
   		}
   	}