Java Easy Solution || Sort Method
```\npublic int[] frequencySort(int[] nums) {\n        Map map=new HashMap<>();//map to store count of each number\n        List list=new ArrayList<>();\n      
```\npublic int[] frequencySort(int[] nums) {\n        Map<Integer,Integer> map=new HashMap<>();//map to store count of each number\n        List<Integer> list=new ArrayList<>();\n        for(int num:nums){\n            if(map.containsKey(num))\n                map.put(num,map.get(num)+1);\n            else{\n                list.add(num);\n                map.put(num,1);\n            }\n        }\n        Collections.sort(list,(a,b)->map.get(a)==map.get(b)?(b-a):map.get(a)-map.get(b));//sorting based on count value first and then number value\n        int arr[]=new int[nums.length];\n        int k=0;\n        for(int num:list){\n            int cnt=map.get(num);\n            while(cnt>0){\n                arr[k++]=num;\n                cnt--;\n            }\n        }\n        return arr;\n    }
[]