import static spark.Spark.*;
import com.google.gson.Gson;
import java.util.Map;
import java.util.HashMap;

public class Main {
    public static void main(String[] args) {
        port(3000);
        get("/", (req, res) -> {

            String str = req.queryParams("str");
            if (str == null) {
                str = "";
            }

            String ch = req.queryParams("ch");
            if (ch == null) {
                ch = "";
            }

            String lenString = req.queryParams("len");
            int len = 0;
            if (lenString != null) {
                len = Integer.parseInt(lenString);
            }

            res.type("application/json");
            Map resp = new HashMap();
            resp.put("str", str);
            return new Gson().toJson(resp);
        });
    }
}

@@ -120,16 +120,258 @@
  Main %7B%0A
+    public static String leftPad(String str, int len, String ch) %7B%0A        StringBuffer padded = new StringBuffer(str);%0A        while (padded.length() %3C len) %7B%0A            padded.append(ch);%0A        %7D%0A        return padded.toString();%0A    %7D%0A%0A
     publ
@@ -990,19 +990,37 @@
 (%22str%22, 
-str
+leftPad(str, len, ch)
 );%0A     

Add java leftpad implementation