자바

 

 

 

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 60  라이트

무슨 일이든지 시작을 조심하라. 처음 한 걸음이 정차의 일을 결정한다. -레오나르도 다빈치

댓글 ( 4)

댓글 남기기

작성