java rest client code example
Example 1: http client java
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://openjdk.java.net/"))
.build();
client.sendAsync(request, BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(System.out::println)
.join();
Example 2: java resto
char calculaLetra(int dni)
{
String juegoCaracteres="TRWAGMYFPDXBNJZSQVHLCKE";
int modulo= dni % 23;
char letra = juegoCaracteres.charAt(modulo);
return letra;
}