```
public class Solution {
public int findKthLargest(int[] nums, int k) {
int max=nums[0];
int min=nums[0];
for(int i=1;i<nums.length;i++){//n
if(nums[i]>max) max=nums[i];
else if(nums[i]<min) min=nums[i];
}
int[] counts=new int[max-min+1];
for(int i=0;i<nums.length;i++){//n
counts[nums[i]-min]++;
}
int large=0;
for(int i=counts.length-1;i>=0;i--){
k-=counts[i];
if(k<=0) {
large = i+min;
break;
}
}
return large;
}
}
```