Below is the Java code which gives all the IP address of the host name.
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
public class CommonUtils {
public static void main(String[] args) {
try {
InetAddress addrs[] = InetAddress.getAllByName("google.com");
Arrays.stream(addrs).forEach(inetAddress -> {
System.out.println(inetAddress);
});
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
}