Usually, you don’t have to worry too much about Internet addresses—the numerical host addresses that consist of 4 bytes (or, with IPv6, 16 bytes) such as 126.96.36.199. However, you can use the
InetAddress class if you need to convert between host names and Internet addresses.
java.net package supports IPv6 Internet addresses, provided the host operating system does.
getByName method returns an
InetAddress object of a host. For example,
InetAddress address = InetAddress.getByName("time-A.timefreq.bldrdoc.gov");
InetAddress object that encapsulates the sequence of four bytes 188.8.131.52. You can access the bytes with the
byte addressBytes = address.getAddress();
Some host ...