endian11
2020-01-06 10e4ece2f9c58fffc4ab9c3c2c5be95941005888
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package com.anyun.exam.lib.util;
 
public class ByteUtil {
    public static String byte2hex(byte [] buffer){
        StringBuilder h = new StringBuilder();
        for(int i = 0; i < buffer.length; i++){
            String temp = Integer.toHexString(buffer[i] & 0xFF).toUpperCase();
            if(temp.length() == 1){
                temp = "0" + temp;
            }
            h.append(temp);
            h.append(" ");
        }
        return h.toString();
    }
}