Помогите с formatter(newbie)

Нужно сделать чтобы когда выводит текст выводился не так. Можно через formatter, можно через printf.

Euro|EUR|9,006.6631

British Pound Sterling|GBP|7,966.1384

United States Dollar|USD|9,717.7182

А вот так:

Это вроде не сложно, спасибо сразу|

Тут ещё lib: json-20190722.jar

вот код:

import org.json.JSONObject;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.util.stream.IntStream;
import java.util.Formatter;

public class Main {
    public static void main(String[] args) throws IOException {
        String url = "https://api.coindesk.com/v1/bpi/currentprice.json";

        URL obj = new URL(url);
        HttpURLConnection connection = (HttpURLConnection) obj.openConnection();
        connection.setRequestMethod("GET");

        BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        StringBuffer response = new StringBuffer();

        System.out.println(url);

        String inputLine;
        while ((inputLine = in.readLine()) != null) {
            response.append(inputLine);
            response.append('\n');
        }

        System.out.print(response.toString());

        JSONObject jsonObject = new JSONObject(response.toString());

        JSONObject bpiObject = jsonObject.getJSONObject("bpi");

        for (int i = 0; i < bpiObject.length(); i++) {
            String key = bpiObject.names().get(i).toString();
            JSONObject currencyObject = bpiObject.getJSONObject(key);
            System.out.println(currencyObject.getString("description") + "|" + currencyObject.getString("code") + "|" + currencyObject.getString("rate"));
        }
    }
}

Ответы (1 шт):

Автор решения: Дмитрий

Тут вроде все просто:

System.out.printf(
    ">%-25s|%-5s|%,10f",
    currencyObject.getString("description"),
    currencyObject.getString("code"),
    currencyObject.getDouble("rate_float")
);
System.out.println();
→ Ссылка