public static Integer getTotalNumberOfItemsFromContentRange(List<Map.Entry<String, String>> responseHeaders) {
        if(responseHeaders == null) return -1;
        Map.Entry<String, String> contentLengthHeader = null;

        for(Map.Entry<String, String> header: responseHeaders) {
            if(header.getKey() != null && header.getKey().toLowerCase().equals("content-range")) {
                contentLengthHeader = header;
            }
        }

        if(contentLengthHeader != null) {
            List<String> hyphenSplit = Arrays.asList(contentLengthHeader.getValue().split("\\-"));
            if(hyphenSplit.size() != 2) {
                return -1;
            }
            List<String> slashSplit = Arrays.asList(hyphenSplit.get(1).split("/"));
            if(slashSplit.size() != 2) {
                return -1;
            }
            String instanceLengthString = slashSplit.get(1).trim();
            if(instanceLengthString.equals("*")) {
                return -2;
            }
            try {
                return Integer.parseInt(instanceLengthString);
            }
            catch(Throwable t) {
                return -1;
            }
        }
        else {
            return -1;
        }
    }