- /**
- * 二行制转字符串
- */
- private static String byte2hex(byte[] b) {
- StringBuffer hs = new StringBuffer();
- String stmp = "";
- for (int n = 0; n < b.length; n++) {
- stmp = (java.lang.Integer.toHexString(b[n] & 0XFF));
- if (stmp.length() == 1)
- hs.append("0").append(stmp);
- else
- hs.append(stmp);
- }
- return hs.toString().toUpperCase();
- }
- //该片段来自于http://www.codesnippet.cn/detail/0508201410141.html
来源: http://www.codesnippet.cn/detail/0508201410141.html