class AreAnagrams {

  public boolean check(String a, String b) {
    if (a == null || b == null) {
      throw new IllegalArgumentException("You can't use null Strings as input.");
    }
    if (a.length() != b.length()) {
      return false;
    }
    int[] lettersA = getLettersAsArray(a);
    int[] lettersB = getLettersAsArray(b);

    int valuesA = getSumOfArray(lettersA);
    int valuesB = getSumOfArray(lettersB);

    return valuesA == valuesB;
  }

}