public GroupAssignment build() {
        if (subscribedTopicIds.isEmpty()) {
            LOG.info("The subscription list is empty, returning an empty assignment");
            return new GroupAssignment(Collections.emptyMap());
        }

        assignStickyPartitions();

        unassignedPartitionsAssignment();

        balance();

        return new GroupAssignment(targetAssignment);
    }
Here's the step-by-step breakdown of the assignment process:

<li> Retain partitions from the existing assignments a.k.a sticky partitions. </li>
<li> Allocate all the remaining unassigned partitions to the members in a balanced manner.</li>
<li> Iterate through the assignment until it is balanced. </li>
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/assignor/UniformHeterogeneousAssignmentBuilder.java