code: public static int parseRevIDNumber(String rev) {
          int result = -1;
          int dashPos = rev.indexOf('-');
          if (dashPos >= 0) {
              try {
                  result = Integer.parseInt(rev.substring(0, dashPos));
              } catch (NumberFormatException e) {
                  // ignore, let it return -1
              }
          }
          return result;
      }
docs: Splits a revision ID into its generation number and opaque suffix string