private static Map<String, TopicDescription> describeTopics(Admin adminClient,
                                                                Set<String> topics) throws ExecutionException, InterruptedException {
        Map<String, KafkaFuture<TopicDescription>> futures = adminClient.describeTopics(topics).topicNameValues();
        Map<String, TopicDescription> res = new HashMap<>();
        for (Entry<String, KafkaFuture<TopicDescription>> e : futures.entrySet()) {
            String topicName = e.getKey();
            KafkaFuture<TopicDescription> topicDescriptionFuture = e.getValue();
            try {
                res.put(topicName, topicDescriptionFuture.get());
            } catch (ExecutionException t) {
                if (t.getCause() instanceof UnknownTopicOrPartitionException)
                    throw new ExecutionException(
                        new UnknownTopicOrPartitionException("Topic " + topicName + " not found."));
                throw t;
            }
        }
        return res;
    }
Calculate the new partition assignments to suggest in --generate.

@param currentAssignment  The current partition assignments.
@param brokerMetadatas    The rack information for each broker.

@return                   A map from partitions to the proposed assignments for each.
tools/src/main/java/org/apache/kafka/tools/reassign/ReassignPartitionsCommand.java