Playing with string matching-algorithms in Java