The concept is to add the elements to a MaxHeap. The nth element that you remove from the queue is going to be the nth largest element. It happens in O(log n).

Here is the solution

```
public class Solution {
public int findKthLargest(int[] nums, int k) {
if(nums==null||nums.length==0){
return 0;
}
Queue<Integer> q = new PriorityQueue<Integer>(new Comparator<Integer>(){
public int compare(Integer i1, Integer i2){
if(i1<i2){
return 1;
}else if(i1>i2){
return -1;
}else{
return 0;
}
}
});
for(int i=0; i<nums.length; i++){
q.offer(nums[i]);
}
int count=1;int val=q.poll();
while(count<k && !q.isEmpty()){
val=q.poll();
count++;
}
return val;
}
}
```