Source:
<code>public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() <START> .credential(new AzureKeyCredential("184654c847d54432b8301a4b76f63045")) <END> .endpoint("<LINK_0>") .buildClient(); List<TextDocumentInput> documents = Arrays.asList( new TextDocumentInput("A", "Satya Nadella is the CEO of Microsoft.").setLanguage("en"), new TextDocumentInput("B", "Elon Musk is the CEO of SpaceX and Tesla.").setLanguage("en") ); TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setIncludeStatistics(true).setModelVersion("latest"); Response<RecognizeEntitiesResultCollection> entitiesBatchResultResponse = client.recognizeEntitiesBatchWithResponse(documents, requestOptions, Context.NONE); System.out.printf("Status code of request response: %d%n", entitiesBatchResultResponse.getStatusCode()); RecognizeEntitiesResultCollection recognizeEntitiesResultCollection = entitiesBatchResultResponse.getValue(); System.out.printf("Results of Azure Text Analytics \"Entities Recognition\" Model, version: %s%n", recognizeEntitiesResultCollection.getModelVersion()); TextDocumentBatchStatistics batchStatistics = recognizeEntitiesResultCollection.getStatistics(); System.out.printf("Documents statistics: document count = %s, erroneous document count = %s, transaction count = %s, valid document count = %s.%n", batchStatistics.getDocumentCount(), batchStatistics.getInvalidDocumentCount(), batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); AtomicInteger counter = new AtomicInteger(); recognizeEntitiesResultCollection.forEach(entitiesResult -> { System.out.printf("%n%s%n", documents.get(counter.getAndIncrement())); if (entitiesResult.isError()) { System.out.printf("Cannot recognize entities. Error: %s%n", entitiesResult.getError().getMessage()); } else { entitiesResult.getEntities().forEach(entity -> System.out.printf( "Recognized entity: %s, entity category: %s, entity subcategory: %s, confidence score: %f.%n", entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore()) ); } }); }</code><technical_language>is endpoint printed somewhere? do need rotate this key</technical_language>

Target:
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); List<TextDocumentInput> documents = Arrays.asList( new TextDocumentInput("A", "Satya Nadella is the CEO of Microsoft.").setLanguage("en"), new TextDocumentInput("B", "Elon Musk is the CEO of SpaceX and Tesla.").setLanguage("en") ); TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setIncludeStatistics(true).setModelVersion("latest"); Response<RecognizeEntitiesResultCollection> entitiesBatchResultResponse = client.recognizeEntitiesBatchWithResponse(documents, requestOptions, Context.NONE); System.out.printf("Status code of request response: %d%n", entitiesBatchResultResponse.getStatusCode()); RecognizeEntitiesResultCollection recognizeEntitiesResultCollection = entitiesBatchResultResponse.getValue(); System.out.printf("Results of Azure Text Analytics \"Entities Recognition\" Model, version: %s%n", recognizeEntitiesResultCollection.getModelVersion()); TextDocumentBatchStatistics batchStatistics = recognizeEntitiesResultCollection.getStatistics(); System.out.printf("Documents statistics: document count = %s, erroneous document count = %s, transaction count = %s, valid document count = %s.%n", batchStatistics.getDocumentCount(), batchStatistics.getInvalidDocumentCount(), batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); AtomicInteger counter = new AtomicInteger(); for (RecognizeEntitiesResult entitiesResult : recognizeEntitiesResultCollection) { System.out.printf("%n%s%n", documents.get(counter.getAndIncrement())); if (entitiesResult.isError()) { System.out.printf("Cannot recognize entities. Error: %s%n", entitiesResult.getError().getMessage()); } else { entitiesResult.getEntities().forEach(entity -> System.out.printf( "Recognized entity: %s, entity category: %s, entity subcategory: %s, confidence score: %f.%n", entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore()) ); } } }