Java - Write code to check if a string contains Any Of another string using variable length method

Requirements

Write code to check if a string contains Any Of another string using variable length method

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String stringToMatch = "book2s.com";
        String candidates = "book2s.com";
        System.out.println(containsAnyOf(stringToMatch, candidates));
    }//from  w  w w . ja  v  a 2 s  .  c  o  m

    public static String containsAnyOf(String stringToMatch,
            String... candidates) {
        for (final String candidate : candidates) {
            if (stringToMatch.contains(candidate)) {
                return candidate;
            }
        }
        return null;
    }
}