code: private static int offsetStrToMillis(String str) {
          boolean isValid = false;
          int sign = 0, hour = 0, min = 0, sec = 0;
  
          do {
              if (str == null) {
                  break;
              }
              int length = str.length();
              if (length != 5 && length != 7) {
                  // utf-offset must be 5 or 7 characters
                  break;
              }
              // sign
              char s = str.charAt(0);
              if (s == '+') {
                  sign = 1;
              } else if (s == '-') {
                  sign = -1;
              } else {
                  // utf-offset must start with "+" or "-"
                  break;
              }
  
              try {
                  hour = Integer.parseInt(str.substring(1, 3));
                  min = Integer.parseInt(str.substring(3, 5));
                  if (length == 7) {
                      sec = Integer.parseInt(str.substring(5, 7));
                  }
              } catch (NumberFormatException nfe) {
                  break;
              }
              isValid = true;
          } while(false);
  
          if (!isValid) {
              throw new IllegalArgumentException("Bad offset string");
          }
          int millis = sign * ((hour * 60 + min) * 60 + sec) * 1000;
          return millis;
      }
docs: /*
  Convert RFC2445 utc-offset string to milliseconds