import org.apache.commons.lang.StringUtils; public class Main { public static void main(String[] args) { String source = "this is a test"; String word = "is"; int wordFound = StringUtils.countMatches(source, word); System.out.println(wordFound); } }