I have an int which contains an IP address in network byte order, which I would like to convert to an InetAddress object. I see that there is an InetAddress constructor that takes a byte[], is it necessary to convert the int to a byte[] first, or is there another way?
I have an int which contains an IP address in network byte order, which
Share
This should work:
You might have to swap the order of the byte array, I can’t figure out if the array will be generated in the correct order.