code: public static UserAgent getUserAgent(String userAgent) {
          if (userAgent == null || userAgent.isEmpty()) {
              return null;
          }
  
          for (String aAGENT_INDEX : AGENT_INDEX) {
              Pattern pattern = AGENT_PATTERNS.get(aAGENT_INDEX);
              Matcher matcher = pattern.matcher(userAgent);
              if (matcher.find()) {
                  return new UserAgent(aAGENT_INDEX, matcher.group(1));
              }
          }
          return null;
      }
docs: get user agent