这应该工作:
int ipAddress = ....byte[] bytes = BigInteger.valueOf(ipAddress).toByteArray();InetAddress address = InetAddress.getByAddress(bytes);
您可能需要交换字节数组的顺序,但我无法弄清楚是否会以正确的顺序生成该数组。

这应该工作:
int ipAddress = ....byte[] bytes = BigInteger.valueOf(ipAddress).toByteArray();InetAddress address = InetAddress.getByAddress(bytes);
您可能需要交换字节数组的顺序,但我无法弄清楚是否会以正确的顺序生成该数组。