code: public static Collection<InetAddress> getNetworkInterfaces()
              throws SocketException {
          final Collection<InetAddress> addresses = new ArrayList<InetAddress>();
          final Enumeration<NetworkInterface> e = 
              NetworkInterface.getNetworkInterfaces();
          while (e.hasMoreElements()) {
              final NetworkInterface ni = e.nextElement();
              final Enumeration<InetAddress> niAddresses = ni.getInetAddresses();
              while (niAddresses.hasMoreElements()) {
                  addresses.add(niAddresses.nextElement());
              }
          }
          return addresses;
      }
docs: Utility method for accessing public interfaces.
  
  @return The {@link Collection} of public interfaces.
  @throws SocketException If there's a socket error accessing the
  interfaces.