Add the java solution to the Pattern Matching problem