[Java] Sorted the Occurrence by Using Collections.sort()..
Looks like there is no others using this in Java at this moment yet, so I post my solution here for your reference.\n\n    public int[] frequencySort(int[] nums
Looks like there is no others using this in Java at this moment yet, so I post my solution here for your reference.\n```\n    public int[] frequencySort(int[] nums) {\n        Map<Integer, Integer> map = new HashMap<>();\n        for (int num : nums) {\n            map.put(num, map.getOrDefault(num, 0) + 1);\n        }\n        List<Map.Entry<Integer, Integer>> list = new ArrayList(map.entrySet());\n        Collections.sort(list, (a,b) -> a.getValue() == b.getValue() ? b.getKey() - a.getKey() : a.getValue() - b.getValue());\n        int index = 0;\n        int[] res = new int[nums.length];\n        for (Map.Entry<Integer, Integer> entry : list) {\n            \n            int count = entry.getValue();\n            int key = entry.getKey();\n            \n            for (int i=0; i<count; i++) {\n                res[index++] = key;\n            }\n        }\n        return res;\n    }\n```
[]