public static int search( byte[] text, int offset, byte[] pattern ) 
	{
		int[] next = initNext( pattern );
		int i = offset, j = 0;
		n = 1;
		while ( i < text.length ) 
		{
			while ( j >= 0 && pattern[j] != text[i] ) 
			{
				j = next[j];
			}
			i++; 
			j++;
			if ( j == pattern.length )
				return i - pattern.length;
		}
		return -1;
	}