```
Set<Integer> result = new TreeSet<Integer>();
Hashtable<Integer, Integer> numbers = new Hashtable<Integer, Integer>();
int n = nums.length;
if(n <=0)
return Collections.emptyList();
int m= n/3;
for (int i = 0; i < n; i++) {
Integer r = numbers.get(nums[i]);
if( r==null)
r=0;
if ((r.intValue()+1) >m) {
result.add(nums[i]);
} else
numbers.put(nums[i], r.intValue()+1);
}
return new ArrayList(result);
```

The main idea behind this algorithm is: 1 use map to store the count 2.use set to eliminate duplication elements.