MCPcopy Create free account
hub / github.com/Frontrooms/3.0-GC / bytesToHex

Method bytesToHex

src/main/java/emu/grasscutter/utils/Utils.java:77–86  ·  view source on GitHub ↗
(byte[] bytes)

Source from the content-addressed store, hash-verified

75
76 private static final char[] HEX_ARRAY = "0123456789abcdef".toCharArray();
77 public static String bytesToHex(byte[] bytes) {
78 if (bytes == null) return "";
79 char[] hexChars = new char[bytes.length * 2];
80 for (int j = 0; j < bytes.length; j++) {
81 int v = bytes[j] & 0xFF;
82 hexChars[j * 2] = HEX_ARRAY[v >>> 4];
83 hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F];
84 }
85 return new String(hexChars);
86 }
87
88 public static String bytesToHex(ByteBuf buf) {
89 return bytesToHex(byteBufToArray(buf));

Callers 3

generateSessionKeyMethod · 0.95
generateLoginTokenMethod · 0.95
logPacketMethod · 0.95

Calls 1

byteBufToArrayMethod · 0.95

Tested by

no test coverage detected