Try utilizing dictionaries like so. (This is untested).
Map<Character, Integer> letterMap1 = new HashMap<Character, Integer>();
Map<Character, Integer> letterMap2 = new HashMap<Character, Integer>();
for (int i = 0; i < charArr1.length; i++) {
if (!letterMap1.containsKey(charArr1[i])) {
letterMap1.put(charArr1[i], 0);
} else {
letterMap1.put(charArr1[i], letterMap1.get(charrArr1[i]charArr1[i]) + 1);
}
}
for (int i = 0; i < charArr2.length; i++) {
if (!letterMap2.containsKey(charArr2[i])) {
letterMap2.put(charArr2[i], 0);
} else {
letterMap2.put(charArr2[i], letterMap2.get(charrArr2[i]charArr2[i]) + 1);
}
}
boolean equivalent = true;
if (letterMap1.size() == letterMap2.size()) {
for (Character c : letterMap1.keySet()) {
if (!letterMap2.containsKey(c)) {
equivalent = false;
break;
} else {
if (letterMap1.get(c) != letterMap2.get(c)) {
equivalent = false;
break;
}
}
}
} else {
equivalent = false;
}
if (equivalent) {
System.out.println("Yes");
} else {
System.out.println("No");
}