Here is my solution, and i got 7ms running time

```
public int majorityElement(int[] nums) {
Arrays.sort(nums);
int current = 0;
for (int i = 1; i < nums.length; i++) {
if (nums[i] != nums[i-1]) {
current = i;
}
if (i - current + 1 > nums.length/2) {
break;
}
}
return nums[current];
}
}```
```