public static int occurrencesOf(String in, String of) {
        int occurrences = 0;

        if (in.length() == of.length())
            return in.equalsIgnoreCase(of) ? 1 : 0;

        if (of.length() > in.length())
            return 0;

        in = in.toLowerCase();
        of = of.toLowerCase();

        for (int i = 0; i < in.length(); ++i) {
            check: if (in.charAt(0) == of.charAt(0)) {
                for (int j = 0; i < in.length() && j < of.length(); ++i, ++j) {
                    if (in.charAt(i) != of.charAt(j))
                        break check;
                }

                ++occurrences;
            }
        }

        return occurrences;
    }