首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

String 变换为unicode码

2012-11-11 
String 转换为unicode码public class SSS {public static void main(String[] args) {String str @7LOB

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.08814051181907784public 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;}}

热点排行