mirror of
https://github.com/LamGC/ScalaBot.git
synced 2025-12-19 08:30:44 +00:00
refactor: 将十六进制转换代码迁移到 Kotlin.
将 ByteUtils 的实现改用 Kotlin 代码做, 移除 ByteUtils. 另外, 本次修改同时修正了方法名错误的问题(hax 改成 hex), 并补充了单元测试.
This commit is contained in:
@ -1,17 +0,0 @@
|
||||
package net.lamgc.scalabot.util;
|
||||
|
||||
final class ByteUtils {
|
||||
|
||||
private ByteUtils() {
|
||||
}
|
||||
|
||||
public static String bytesToHexString(byte[] bytes) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (byte aByte : bytes) {
|
||||
String hexBit = Integer.toHexString(aByte & 0xFF);
|
||||
builder.append(hexBit.length() == 1 ? "0" + hexBit : hexBit);
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user