code: public static int getVersionId(String version) throws IllegalStateException {
          int versionID = 0;
          if ("4.0".equals(version)) {
              versionID = 40;
          }else if ("3.1".equals(version)) {
              versionID = 31;
          } else if ("3.0".equals(version)) {
              versionID = 30;
          } else if ("2.5".equals(version)) {
              versionID = 25;
          } else if ("2.4".equals(version)) {
              versionID = 24;
          } else if ("2.3".equals(version)) {
              versionID = 23;
          } else if ("2.2".equals(version)) {
              versionID = 22;
          } else {
              throw new IllegalStateException("invalid web-app version");
          }
          return versionID;
      }
docs: Convert a version ID string value to an integer value.  The integer value
  is ten (10) times the string value converted to a numeric value.
  
  @param version The version as a string value.
  
  @return The version as an integer value.
  
  @throws IllegalStateException Thrown if the version string value is not a
  valid servlet specification level.  That is, "2.2", "2.3", "2.4", "2.5",
  "3.0", or "3.1".  "3.1" is accepted even if the supported specification
  level is 3.0.