**
* 将数组转成字符串 在调试或记录日志时用到
*
* @param array
* @return
*/
public static String byte2string(byte[] array) {
StringBuilder sb = new StringBuilder();
sb.append("Length " + array.length + " Content ");
for (int i = 0; i < leng; i++) {
sb = sb.append(String.format("%02X", array[i])).append(":");
}
int ind = sb.lastIndexOf(":");
sb.delete(ind, ind + 1);
return sb.toString();
|