static String curReassignmentsToString(Admin adminClient) throws ExecutionException, InterruptedException {
        Map<TopicPartition, PartitionReassignment> currentReassignments = adminClient.
            listPartitionReassignments().reassignments().get();
        String text = currentReassignments.keySet().stream().sorted(ReassignPartitionsCommand::compareTopicPartitions).map(part -> {
            PartitionReassignment reassignment = currentReassignments.get(part);
            List<Integer> replicas = reassignment.replicas();
            List<Integer> addingReplicas = reassignment.addingReplicas();
            List<Integer> removingReplicas = reassignment.removingReplicas();

            return String.format("%s: replicas: %s.%s%s",
                part,
                replicas.stream().map(Object::toString).collect(Collectors.joining(",")),
                addingReplicas.isEmpty() ? "" : String.format(" adding: %s.", addingReplicas.stream()
                    .map(Object::toString)
                    .collect(Collectors.joining(","))),
                removingReplicas.isEmpty() ? "" : String.format(" removing: %s.", removingReplicas.stream()
                    .map(Object::toString)
                    .collect(Collectors.joining(",")))
            );
        }).collect(Collectors.joining(System.lineSeparator()));

        return text.isEmpty()
            ? "No partition reassignments found."
            : String.format("Current partition reassignments:%n%s", text);
    }
Convert the current partition reassignments to text.

@param adminClient   The AdminClient to use.
@return              A string describing the current partition reassignments.
tools/src/main/java/org/apache/kafka/tools/reassign/ReassignPartitionsCommand.java