import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Scanner;
public class ConsutlaCoingecko {
public static void main(String[] args) throws IOException, InterruptedException {
String apikey = "xxxxxxxxxxxxxxxxxxxxxx";
Scanner sc = new Scanner(System.in);
System.out.println("Digite sua crypto para buscar: ");
String buscar = sc.nextLine();
String endereco = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids="+buscar+"&x_cg_demo_api_key="+apikey;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder().uri(URI.create(endereco)).build();
HttpResponse<String> response = client
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}