code: public static boolean validate(final String ip) {
          Matcher matcher = pattern.matcher(ip);
          return matcher.matches();
      }
docs: Validate ipv4 address with regular expression
  
  @param ip
  address for validation
  
  @return true valid ip address, false invalid ip address