A previous method called letterCounts required "counts the number of times that each letter occurs in the specified string and returns the result as an int array, where the number of ‘A’s is stored at position [0], the number of ‘B’s is stored at position [1], and so on:".
Now I have tried to create the method wordInLetters but I am stuck as to how to proceed to create a method that does what the title of this post says.
static boolean wordInLetters(final String word, final int[] letterCounts) {
boolean hasEnough = true;
for (int i = 0; i <word.length(); i ++){
if (word.charAt(i) < letterCounts[i]){
hasEnough = false;
}
else {return true;}
}
return hasEnough;
}
}