private static String processMediaUrl(String url, String representationId,
                                          Integer number, Integer bandwidth, Long time) {
        // RepresentationID
        if(representationId != null) {
            url = url.replace("$RepresentationID$", representationId);
        }

        // Number, Bandwidth & Time with formatting support
        // The following block converts DASH segment URL templates to a Java String.format expression

        List<String> templates = Arrays.asList("Number", "Bandwidth", "Time");
        Matcher matcher = PATTERN_TEMPLATE.matcher(url);

        while(matcher.find()) {
            String template = matcher.group(1);
            String pattern = matcher.group(2);
            int index = templates.indexOf(template);

            if(pattern != null) {
                url = url.replace("$" + template + pattern + "$",
                        "%" + (index + 1) + "$" + pattern.substring(1));
            } else {
                // Table 16: If no format tag is present, a default format tag with width=1 shall be used.
                url = url.replace("$" + template + "$", "%" + (index + 1) + "$01d");
            }
        }

        url = String.format(url, number, bandwidth, time); // order must match templates list above

        // $$
        // Replace this at the end, else it breaks directly consecutive template expressions,
        // e.g. $Bandwidth$$Number$.
        url = url.replace("$$", "$");

        return url;
    }
Processes templates in media URLs.

Example: $RepresentationID$_$Number%05d$.ts

5.3.9.4.4 Template-based Segment URL construction
Table 16 - Identifiers for URL templates
MediaPlayer-DASH/src/main/java/net/protyposis/android/mediaplayer/dash/DashParser.java