code: static boolean matches(String template, String hostName) {
          if (template.startsWith("*.")) {
              return template.regionMatches(2, hostName, 0, hostName.length())
                  || commonSuffixOfLength(hostName, template, template.length() - 1);
          }
          return template.equals(hostName);
      }
docs: Simple function to match <a href="http://en.wikipedia.org/wiki/Wildcard_DNS_record">DNS wildcard</a>.