String에서 유니코드로 변환

746 단어 unicode


public class SSS {

	public static void main(String[] args) {

		String str = "@7LOBlHIXq";
		int s = encrypt(str);
		System.out.println(s);
		System.out.println(1167191711);
	}

	// &g_tk=1167191711&r=0.08814051181907784

	public static int encrypt(String g_tk) {

		int hash = 5381;
		for (int i = 0, len = g_tk.length(); i < len; ++i) {
			char ch = g_tk.charAt(i);
			int tmp = (int) ch;
			String s = Integer.toHexString(tmp);
			hash += (hash << 5) + Integer.parseInt(s, 16);

		}
		return hash & 0x7fffffff;

	}
}




좋은 웹페이지 즐겨찾기