摘要: Codepublic static String substring(String str,int s,int len){ byte[] substr = new byte[len]; System.arraycopy(str.getBytes(), s-1, substr, 0, len-1); str = new String(substr); return str.trim(); ... 阅读全文
posted @ 2012-04-23 16:03 天纯蓝 阅读(557) 评论(0) 推荐(0) 编辑
摘要: Codepublic static String convertStringUTF(String gbk) { String utf8 = gbk; try { if (!utf8.equals("") && utf8 != null) { utf8 = new String(gbk2utf8(gbk), "UTF-8"); } } catch (UnsupportedEncodingException e) { utf8 = gbk; } return utf8; } public static byte[] gbk2utf8(Stri 阅读全文
posted @ 2012-04-23 16:01 天纯蓝 阅读(204) 评论(0) 推荐(0) 编辑
摘要: Codeimport java.security.MessageDigest;public class MD5 { //十六进制下数字到字符的映射数组 private final static String[] hexDigits = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", 阅读全文
posted @ 2012-04-23 15:58 天纯蓝 阅读(201) 评论(0) 推荐(0) 编辑