HexUtil#format方法增加prefix参数

This commit is contained in:
Looly
2024-02-26 15:57:05 +08:00
parent 5dd8d51f7a
commit 832235f5e8
4 changed files with 32 additions and 6 deletions

View File

@@ -72,6 +72,13 @@ public class HexUtilTest {
Assert.assertEquals("e8 c6 70 38 0c b2 20 09 52 68 f4 02 21 fc 74 8f a6 ac 39 d6 e9 30 e6 3c 30 da 68 ba d9 7f 88 5d", formatHex);
}
@Test
public void formatHexTest2(){
final String hex = "e8c670380cb220095268f40221fc748fa6";
final String formatHex = HexUtil.format(hex, "0x");
Assert.assertEquals("0xe8 0xc6 0x70 0x38 0x0c 0xb2 0x20 0x09 0x52 0x68 0xf4 0x02 0x21 0xfc 0x74 0x8f 0xa6", formatHex);
}
@Test
public void decodeHexTest(){
final String s = HexUtil.encodeHexStr("6");