Исанаграмма Ява

static boolean isAnagram(String a, String b) {
        
        int lenA = a.length();
        int lenB = b.length();
        
        if (lenA != lenB) {
            return false;
        } 
        
        for (int i = 0 ; i < lenA; i++) {
            String s = "(?i)" + Character.toString(a.charAt(i));
            int c1 = lenA - a.replaceAll(s, "").length();
            int c2 = lenB - b.replaceAll(s, "").length();
            if (c1 != c2) {
                return false;
            } 
        }
        
        return true;
    }
Ghaith Alzin