public String strStr(String haystack, String needle) {
		if (needle.isEmpty())
			return haystack;
		if (haystack.isEmpty())
			return null;

		int m = 0; // the beginning of the current match in haystack
		int i = 0; // the position of the current character in needle
		int[] T = kmpTable(needle);

		while (m + i < haystack.length()) {
			if (needle.charAt(i) == haystack.charAt(m + i)) {
				if (i == needle.length() - 1)
					return haystack.substring(m);
				else
					i++;
			} else {
				m = m + i - T[i]; // it is good to set T[0] = -1;
				if (T[i] > -1)
					i = T[i];
				else
					i = 0;

			}
		}
		return null;
	}