code: public static void main(String argv[]) throws Exception {
      System.out.println("Enter a string with HTML ampersand codes, umlauts and/or UTF-8 codes and hit ENTER.");
      System.out.println("Press CTRL+C to abort");
      BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
      while (true) {
        String s = in.readLine();
        System.out.println("Decoded: " + (s = decode(s)));
        System.out.println("Normalized: " + normalize(s));
        System.out.println("As UTF8: " + encodeUTF8(s));
        System.out.println("As percentage: " + encodePercentage(s));
        System.out.println("As backslash: " + encodeBackslash(s));
        System.out.println("As ampersand: " + encodeAmpersand(s));
        System.out.println("As URI component: " + encodeURIPathComponent(s));
      }
    }
docs: Test routine