private int[] getPorts(String portString) {
        //throws NumberFormatException
        Matcher rangeMatcher = Pattern
                .compile("^(\\d+)-(\\d+)\\Z")
                .matcher("");
        String[] commaDelimited = portString.split(",");
        List<Integer> indivPorts = new ArrayList<>();
        for (String val : commaDelimited) {
            rangeMatcher.reset(val);
            if (rangeMatcher.find()) {
                int min = Math.min(Integer.parseInt(rangeMatcher.group(1)), Integer.parseInt(rangeMatcher.group(2)));
                int max = Math.max(Integer.parseInt(rangeMatcher.group(1)), Integer.parseInt(rangeMatcher.group(2)));
                for (int i = min; i <= max; i++) {
                    indivPorts.add(i);
                }
            } else {
                indivPorts.add(Integer.parseInt(val));
            }
        }
        return indivPorts
                .stream()
                .mapToInt(Integer::intValue)
                .toArray();
    }
***
these should only be used in the commandline for a forked process
****
tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/TikaServerConfig.java