자바

 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public static void main(String[] args) {
 
    System.out.println("Bytes to Hex: " + convertBytesToHex());
}
 
private static String convertBytesToHex() {
    byte[] bytes = new byte[3];
    new Random().nextBytes(bytes);        
    StringBuilder result = new StringBuilder();
    for (byte temp : bytes) {
        result.append(String.format("%02x", temp));
    }
    return result.toString();
}

 

 

about author

PHRASE

Level 1  라이트

댓글 ( 4)

댓글 남기기

작성