code: public Enumeration<InetAddress> getInetAddresses() {
  
          class checkedAddresses implements Enumeration<InetAddress> {
  
              private int i=0, count=0;
              private InetAddress local_addrs[];
  
              checkedAddresses() {
                  local_addrs = new InetAddress[addrs.length];
                  boolean trusted = true;
  
                  SecurityManager sec = System.getSecurityManager();
                  if (sec != null) {
                      try {
                          sec.checkPermission(new NetPermission("getNetworkInformation"));
                      } catch (SecurityException e) {
                          trusted = false;
                      }
                  }
                  for (int j=0; j<addrs.length; j++) {
                      try {
                          if (sec != null && !trusted) {
                              sec.checkConnect(addrs[j].getHostAddress(), -1);
                          }
                          local_addrs[count++] = addrs[j];
                      } catch (SecurityException e) { }
                  }
  
              }
  
              public InetAddress nextElement() {
                  if (i < count) {
                      return local_addrs[i++];
                  } else {
                      throw new NoSuchElementException();
                  }
              }
  
              public boolean hasMoreElements() {
                  return (i < count);
              }
          }
          return new checkedAddresses();
  
      }
docs: Convenience method to return an Enumeration with all or a
  subset of the InetAddresses bound to this network interface.
  <p>
  If there is a security manager, its <code>checkConnect</code>
  method is called for each InetAddress. Only InetAddresses where
  the <code>checkConnect</code> doesn't throw a SecurityException
  will be returned in the Enumeration. However, if the caller has the
  {@link NetPermission}("getNetworkInformation") permission, then all
  InetAddresses are returned.
  @return an Enumeration object with all or a subset of the InetAddresses
  bound to this network interface