code: public static long parseBytes(String input, ConfigOrigin originForException,
              String pathForException) {
          String s = ConfigImplUtil.unicodeTrim(input);
          String unitString = getUnits(s);
          String numberString = ConfigImplUtil.unicodeTrim(s.substring(0,
                  s.length() - unitString.length()));
  
          // this would be caught later anyway, but the error message
          // is more helpful if we check it here.
          if (numberString.length() == 0)
              throw new ConfigException.BadValue(originForException,
                      pathForException, "No number in size-in-bytes value '"
                              + input + "'");
  
          MemoryUnit units = MemoryUnit.parseUnit(unitString);
  
          if (units == null) {
              throw new ConfigException.BadValue(originForException, pathForException,
                      "Could not parse size-in-bytes unit '" + unitString
                              + "' (try k, K, kB, KiB, kilobytes, kibibytes)");
          }
  
          try {
              // if the string is purely digits, parse as an integer to avoid
              // possible precision loss; otherwise as a double.
              if (numberString.matches("[0-9]+")) {
                  return Long.parseLong(numberString) * units.bytes;
              } else {
                  return (long) (Double.parseDouble(numberString) * units.bytes);
              }
          } catch (NumberFormatException e) {
              throw new ConfigException.BadValue(originForException, pathForException,
                      "Could not parse size-in-bytes number '" + numberString + "'");
          }
      }
docs: Parses a size-in-bytes string. If no units are specified in the string,
  it is assumed to be in bytes. The returned value is in bytes. The purpose
  of this function is to implement the size-in-bytes-related methods in the
  Config interface.
  
  @param input
  the string to parse
  @param originForException
  origin of the value being parsed
  @param pathForException
  path to include in exceptions
  @return size in bytes
  @throws ConfigException
  if string is invalid