String 转换为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;

	}
}



你可能感兴趣的:(unicode)