Java - Write code to check if a string is Utf Url

Requirements

Write code to check if a string is Utf Url

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String text = "http://book2s.com";
        System.out.println(isUtf8Url(text));
    }//  w ww . jav a  2s .co m

    public static boolean isUtf8Url(String text) {
        text = text.toLowerCase();
        int p = text.indexOf("%");
        if (p != -1 && text.length() - p > 9) {
            text = text.substring(p, p + 9);
        }

        String sign = "";
        if (text.startsWith("%e")) {
            p = 0;
            for (int i = 0; p != -1; i++) {
                p = text.indexOf("%", p);
                if (p != -1)
                    p++;
                sign += p;
            }
        }
        return sign.equals("147-1");
    }
}