[Java] Runtime: 2ms, faster than 99.27% || Memory usage less than 96.56%
\nclass Solution {\n    public boolean isAnagram(String s, String t) {\n        if (s == null || t == null)\n            return false;\n        \n        if (s.
```\nclass Solution {\n    public boolean isAnagram(String s, String t) {\n        if (s == null || t == null)\n            return false;\n        \n        if (s.length() != t.length())\n            return false;\n        \n        String firstSort = sortString(s);\n        String secondSort = sortString(t);\n        return firstSort.equals(secondSort);\n    }\n\n    private String sortString(String s) {\n        char[] chars = s.toCharArray();\n        Arrays.sort(chars);\n        return new String(chars);\n    }\n}\n```\n\n![image](https://assets.leetcode.com/users/images/d35cd34c-2037-4c4d-9268-db4f53571307_1666411826.7447999.jpeg)\n
['Java']