code: public static String getLocalIp() throws UnknownHostException {
          String preffered = System.getProperty(PREFERED_ADDRESS_PROPERTY_NAME);
          return chooseAddress(preffered).getHostAddress();
      }
docs: Returns the local IP. It loops through the network interfaces and returns the first non loopback address
  
  @return
  @throws UnknownHostException