code: public static String[] getCookieValues(Cookie[] cookies, String cookieName) {
          if (cookies == null) {
              return null;
          }
  
          Vector<String> retValues = new Vector<String>();
          for (int i = 0; i < cookies.length; ++i) {
              if (cookieName.equalsIgnoreCase(cookies[i].getName())) {
                  retValues.add(cookies[i].getValue());
              }
          }
  
          if (retValues.size() > 0) {
              return retValues.toArray(new String[retValues.size()]);
          } else {
              return null;
          }
      }
docs: Retrieve the value of the all instances of the specified Cookie name
  from the array of Cookies. Note name matching ignores case.
  
  @param cookies array of Cookie objects, may be {@code null}.
  @param cookieName the name of the cookie
  @return String[] of the values associated with the specified cookieName, {@code null} if no match could not be found.