code: private static Integer toInteger(String str) {
          char[] chars = str.toCharArray();
  
          int result = 0;
  
          int multiplier = 1;
          for (int i = chars.length - 1; i >= 0; --i, multiplier *= 10) {
              char c = chars[i];
              if ('0' <= c && c <= '9') {
                  result += (c - '0') * multiplier;
              } else {
                  return null;
              }
          }
  
          return result;
      }
docs: A very simplistic conversion of string to positive integer in only decimal radix.
  
  <p>This is used to figure out whether a segment id represents an index or a key.
  
  @param str the string potentially representing a number
  @return the parsed number or null if the string is not a supported number