[Java] || Easy To Understand || 2 HashMaps
\nclass Solution {\n    public boolean digitCount(String num) {\n        // Create a map for given frequencies\n        HashMap<Character, Integer> givenFreqMap
```\nclass Solution {\n    public boolean digitCount(String num) {\n        // Create a map for given frequencies\n        HashMap<Character, Integer> givenFreqMap = new HashMap<>();\n        \n        // Create a map to count frequencies manually\n        HashMap<Character, Integer> countFreqMap = new HashMap<>();\n        \n        // Loop through num\n        for(int i = 0; i < num.length(); i++){\n            \n            // We only want to put in map if value at index is not equals to 0\n            // because 0 means it\'s not in the string so we do not need that\n            if(num.charAt(i) != \'0\'){\n                // Add to givenFreqMap convert the index to char and it\'s value from char to int\n                givenFreqMap.put((char)(i+\'0\'), num.charAt(i) - \'0\');\n            }\n        }\n        \n        // Loop through num     \n        for(char c : num.toCharArray()){\n            \n            // Add to countFreqMap and count thier frequencies\n            countFreqMap.put(c, countFreqMap.getOrDefault(c, 0) + 1);\n        }\n                 \n        // If the characters and its frequencies are same in both map then return true, else false\n        return givenFreqMap.equals(countFreqMap);\n        \n    }\n}\n```
['Java']