```
public int hIndex(int[] citations) {
Arrays.sort(citations);
int len = citations.length;
int mx = 0;
for(int i = len-1; i >= 0 ; i--){
if(citations[len - 1 - i] >= i+1) mx = Math.max(mx,i+1);
}
return mx;
}
```