code: public static boolean isIPv4(final String ip) {
          if (StringUtils.isBlank(ip)) {
              return false;
          }
  
          final String regex = "^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
          final Pattern pattern = Pattern.compile(regex);
          final Matcher matcher = pattern.matcher(ip);
  
          return matcher.matches();
      }
docs: Is IPv4.
  
  @param ip ip
  @return {@code true} if it is, returns {@code false} otherwise