// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.net.InetAddress;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

public class DNSLookup {
    private static final String MS = "www.microsoft.com";
    public static void main(String[] args) throws Exception {
        Map<String, Integer> m = new HashMap<String, Integer>();
        InetAddress[] all = InetAddress.getAllByName(MS);
        for(InetAddress one : all) {
            m.put(one.getHostAddress(), 0);
        }
        for(int i = 0; i < 10000; i++) {
            String ms = InetAddress.getByName(MS).getHostAddress();
            m.put(ms, m.get(ms) + 1);
        }
        for(Entry<String, Integer> e : m.entrySet()) {
            System.out.println(e.getKey() + ": " + e.getValue());
        }
    }
}
