(double ratio, int width)
| 527 | } |
| 528 | |
| 529 | private static String progressBar(double ratio, int width) { |
| 530 | ratio = Math.max(0, Math.min(1, ratio)); |
| 531 | int filled = (int) Math.round(ratio * width); |
| 532 | StringBuilder bar = new StringBuilder("["); |
| 533 | for (int i = 0; i < width; i++) { |
| 534 | bar.append(i < filled ? '█' : '░'); |
| 535 | } |
| 536 | bar.append("]"); |
| 537 | return bar.toString(); |
| 538 | } |
| 539 | |
| 540 | private static String formatTokens(int tokens) { |
| 541 | if (tokens >= 1_000_000) return String.format("%.1fM", tokens / 1_000_000.0); |
no test coverage detected