code: public List<String> getSubset(int numShards, Collection<String> primary) {
          /**
           * If netmask in unset, we'll use manual
           */
          if (networkMask == null)
              return getIntersections(numShards, primary);
  
          List<String> addresses = new ArrayList<>();
  
          SubnetUtils utils = new SubnetUtils(networkMask);
  
          Collections.shuffle(informationCollection);
  
          for (NetworkInformation information : informationCollection) {
              for (String ip : information.getIpAddresses()) {
                  if (primary != null && primary.contains(ip))
                      continue;
  
                  if (utils.getInfo().isInRange(ip)) {
                      log.debug("Picked {} as {}", ip, primary == null ? "Shard" : "Backup");
                      addresses.add(ip);
                  }
  
                  if (addresses.size() >= numShards)
                      break;
              }
  
              if (addresses.size() >= numShards)
                  break;
          }
  
          return addresses;
      }
docs: This method returns specified number of IP addresses from original list of addresses, that are NOT listen in primary collection
  
  @param numShards
  @param primary Collection of IP addresses that shouldn't be in result
  @return