public static void urlEncode(String str, StringBuilder sb) {
        for (int idx = 0; idx < str.length(); ++idx) {
            char c = str.charAt(idx);
            if ('+' == c) {
                sb.append("%2B");
            } else if ('%' == c) {
                sb.append("%25");
            } else {
                sb.append(c);
            }
        }
    }
@Test
    public void urlEncode() {
        String str = "hello+World%";
        String expected = "hello%2BWorld%25";
        StringBuilder stringBuilder = new StringBuilder();
        GroupKey.urlEncode(str, stringBuilder);
        Assert.isTrue(stringBuilder.toString().contains(expected));
    }