Sometimes a website used more than one IP addresses. Following code snippet prints all the IP addresses for the given site.

Java Code:
try {
      InetAddress[] addresses = 
       InetAddress.getAllByName("www.microsoft.com");
      for (int i = 0; i < addresses.length; i++) {
        System.out.println(addresses[i]);
      }
    }
    catch (UnknownHostException ex) {
      System.out.println("Could not find www.microsoft.com");
    }