Java URL Build buildURL(int imageId)

Here you can find the source of buildURL(int imageId)

Description

build URL

License

Apache License

Declaration

public static String buildURL(int imageId) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static final String SUFFIX_SMALL = "214x261.jpg";
    public static String STARS_SERVICE_PREFIX = "http://raymcompreviewprod";

    public static String buildURL(int imageId) {
        StringBuilder builder = new StringBuilder("/");
        for (int i = 1; i < 9; i++) {

            builder.append(imageId % (int) Math.pow(10, i) / (int) Math.pow(10, i - 1));
            if ((i % 2) == 0) {
                builder.append("/");
            }// w w w  .  j a  v  a  2  s .c o m
        }
        return STARS_SERVICE_PREFIX
                + String.format("%sfinal/%d-" + SUFFIX_SMALL, builder.reverse().toString(), imageId);
    }
}

Related

  1. buildQueryString(Map parameters)
  2. buildQueryString(Map params)
  3. buildQueryString(Map queryParams)
  4. buildQueryString(Map params)
  5. buildQueryString(Multimap params)
  6. buildUrl(String base, String local)
  7. buildUrl(String cid, String lid, String sid, String pid, String qid, String imageName)
  8. buildURL(String host, int port, String base, String ext)
  9. buildUrl(String host, String target)