public static long jvmMemoryStringToBytes(String value) {
    try {
      value = value.strip();
      char lastChar = value.charAt(value.length() - 1);
      if (Character.isDigit(lastChar)) {
        return Long.parseLong(value);
      } else {
        long base = Long.parseLong(value.substring(0, value.length() - 1));
        lastChar = Character.toLowerCase(lastChar);
        return switch (lastChar) {
          case 'k' -> base * 1024L;
          case 'm' -> base * 1024L * 1024L;
          case 'g' -> base * 1024L * 1024L * 1024L;
          default -> throw new NumberFormatException();
        };
      }
    } catch (NumberFormatException e) {
      throw new IllegalArgumentException("Unable to parse size: " + value);
    }
  }
Parses a value for {@code -Xmx/-Xms} JVM option like "100" or "500k" or "15g"
planetiler-core/src/main/java/com/onthegomap/planetiler/util/Parse.java