@Override
    public SpellCheckResult check(String word) {
        for (int j = 0; j < wordsInDictionary.length; j++) {
            if (word.compareTo(wordsInDictionary[j]) == 0) {
                return new SpellCheckResult();
            } else if (word.compareTo(wordsInDictionary[j]) < 0) {
                if (j == 0) {
                    return new SpellCheckResult(j, null, wordsInDictionary[j]);
                }
                return new SpellCheckResult(j, wordsInDictionary[j - 1], wordsInDictionary[j]);
            }
        }
        return new SpellCheckResult(wordsInDictionary.length - 1, wordsInDictionary[wordsInDictionary.length - 1], null);
    }