Here you can find the source of urlDecoder(String encoded)
public static String urlDecoder(String encoded)
//package com.java2s; public class Main { public static String urlDecoder(String encoded) { StringBuffer decoded = new StringBuffer(); int len = encoded.length(); for (int i = 0; i < len; ++i) { if (encoded.charAt(i) == '%' && i + 2 < len) { int d1 = Character.digit(encoded.charAt(i + 1), 16); int d2 = Character.digit(encoded.charAt(i + 2), 16); if (d1 != -1 && d2 != -1) decoded.append((char) ((d1 << 4) + d2)); i += 2;//from ww w.ja v a 2 s .c o m } else if (encoded.charAt(i) == '+') decoded.append(' '); else decoded.append(encoded.charAt(i)); } return decoded.toString(); } }