public Integer nextAvailableGroupAddress(@NonNull final Provisioner provisioner) throws IllegalStateException {
        if (provisioner.getAllocatedGroupRanges().isEmpty()) {
            throw new IllegalArgumentException("Provisioner has no group range allocated.");
        }

        Collections.sort(groups, groupComparator);
        for (AllocatedGroupRange range : provisioner.getAllocatedGroupRanges()) {
            //If the list of groups are empty we can start with the lowest address of the range
            if (groups.isEmpty()) {
                return range.getLowAddress();
            }

            for (int address = range.lowAddress; address < range.getHighAddress(); address++) {
                //if the address is not in use, return it as the next available address to create a group
                if (!isGroupAddressInUse(address)) {
                    return address;
                }
            }
        }
        return null;
    }
Returns the next available group  address for a provisioner based on the allocated group range

@param provisioner {@link Provisioner}
@return Group address
@throws IllegalStateException if there is no allocated group range to this provisioner
mesh/src/main/java/no/nordicsemi/android/mesh/MeshNetwork.java