code: private boolean selfAssignDeviceNumber() {
          final long now = System.currentTimeMillis();
          final long started = DeviceFinder.getInstance().getFirstDeviceTime();
          if (now - started < SELF_ASSIGNMENT_WATCH_PERIOD) {
              try {
                  Thread.sleep(SELF_ASSIGNMENT_WATCH_PERIOD - (now - started));  // Sleep until we hit the right time
              } catch (InterruptedException e) {
                  logger.warn("Interrupted waiting to self-assign device number, giving up.");
                  return false;
              }
          }
          Set<Integer> numbersUsed = new HashSet<Integer>();
          for (DeviceAnnouncement device : DeviceFinder.getInstance().getCurrentDevices()) {
              numbersUsed.add(device.getNumber());
          }
  
          // Try all player numbers less than mixers use, only including the real player range if we are configured to.
          final int startingNumber = (getUseStandardPlayerNumber() ? 1 : 5);
          for (int result = startingNumber; result < 16; result++) {
              if (!numbersUsed.contains(result)) {  // We found one that is not used, so we can use it
                  setDeviceNumber((byte) result);
                  if (getUseStandardPlayerNumber() && (result > 4)) {
                      logger.warn("Unable to self-assign a standard player number, all are in use. Using number " +
                              result + ".");
                  }
                  return true;
              }
          }
          logger.warn("Found no unused device numbers between " + startingNumber + " and 15, giving up.");
          return false;
      }
docs: Try to choose a device number, which we have not seen on the network. Start by making sure
  we have been watching long enough to have seen the other devices. Then, if {@link #useStandardPlayerNumber} is
  {@code true}, try to use a standard player number in the range 1-4 if possible. Otherwise (or if all those
  numbers are already in use), pick a number from 5 to 15.