NetUtil.bigIntegerToIPv6增加长度修正

This commit is contained in:
Looly
2024-11-05 18:15:44 +08:00
parent 00fac9d39a
commit faa1ee138b
2 changed files with 38 additions and 3 deletions

View File

@@ -0,0 +1,15 @@
package org.dromara.hutool.core.net;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.math.BigInteger;
public class Ipv6UtilTest {
@Test
void bigIntegerToIPv6Test() {
final BigInteger bigInteger = new BigInteger("21987654321098765432109876543210", 10);
final String ipv6Address = Ipv6Util.bigIntegerToIPv6(bigInteger);
Assertions.assertEquals("0:115:85f1:5eb3:c74d:a870:11c6:7eea", ipv6Address);
}
}