public class BF { public static void main(String[] args) { BF bf = new BF(); boolean f = bf.strFind("abcdefg", "de"); System.out.println(f); } public boolean strFind(String p, String s) { for (int i = 0, j; i <= p.length() - s.length(); i++) { for (j = 0; j < s.length(); j++) { if (p.charAt(i + j) != s.charAt(j)) break; } if (j == s.length()) return true; } return false; } }