3 solutions: sort, hash array and prime.
1.Sort\n\n    public boolean isAnagram(String s, String t) {\n        if (s == t || s.equals(t)) {\n            return true;\n        }\n        char[] sArray =
1.Sort\n\n    public boolean isAnagram(String s, String t) {\n        if (s == t || s.equals(t)) {\n            return true;\n        }\n        char[] sArray = s.toCharArray();\n        Arrays.sort(sArray);\n        String sortedS = new String(sArray);\n        char[] tArray = t.toCharArray();\n        Arrays.sort(tArray);\n        String sortedT = new String(tArray);\n        return sortedS.equals(sortedT);\n    }\n\n2.Hash Array\n\n    public boolean isAnagram(String s, String t) {\n        int[] hash = new int[26];\n        for (int i = 0; i < s.length(); i++) {\n            hash[s.charAt(i) - 'a']++;\n        }\n        for (int i = 0; i < t.length(); i++) {\n            hash[t.charAt(i) - 'a']--;\n        }\n        for (int i = 0; i < hash.length; i++) {\n            if (hash[i] != 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n3.Prime\n\n    private static final int[] PRIMES = new int[]{3, 5, 7, 11 ,13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,\n            73, 79, 83, 89, 97, 101, 107};\n    public boolean isAnagram(String s, String t) {\n        return hash(s) == hash(t);\n    }\n\n    private long hash(String s) {\n        long hash = 1;\n        for (int i = 0; i < s.length(); i++) {\n            hash *= PRIMES[s.charAt(i) - 'a'];\n        }\n        return hash;\n    }
['Java']