code: public static Collection<InterfaceAddress> getAllIPAddresses() throws SocketException  {
          ArrayList<InterfaceAddress> direcciones = new ArrayList();
          InterfaceAddress ipLoopback = null;
          
          try {
              Enumeration ifaces = NetworkInterface.getNetworkInterfaces();
              while (ifaces.hasMoreElements()) {
                  NetworkInterface iface = (NetworkInterface) ifaces.nextElement();
                  for (InterfaceAddress ips : iface.getInterfaceAddresses())
                  {
                      InetAddress ia = ips.getAddress();
                      if (!ia.getHostAddress().contains(":")) {
                          if (ia.isLoopbackAddress()) {
                              ipLoopback = ips;
                          } else {
                              direcciones.add(ips);
                          }
                      }
                  }
              }
              
              if ((direcciones.isEmpty()) && (ipLoopback != null))
              {
                  direcciones.add(ipLoopback);
              }
          } catch (SocketException e) {
              throw e;
          }
          
          return direcciones;
      }
docs: Retrieves all the IP addresses of the local computer.
  The loopback address (127.0.0.1) will not be included.