(byte[] bytes)
| 349 | |
| 350 | // 字节数组转hex |
| 351 | public static String bytesToHex(byte[] bytes) { |
| 352 | StringBuffer sb = new StringBuffer(); |
| 353 | for(int i = 0; i < bytes.length; i++) { |
| 354 | String hex = Integer.toHexString(bytes[i] & 0xFF); |
| 355 | if(hex.length() < 2){ |
| 356 | sb.append(0); |
| 357 | } |
| 358 | sb.append(hex); |
| 359 | } |
| 360 | return sb.toString(); |
| 361 | } |
| 362 | |
| 363 | |
| 364 | } |