kmp algorithm using Java