Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static final int TOTAL_NUMBER_OF_DOTS = 10;
- // https://twitter.com/NabheetS/status/1616461311139016710
- private static String getPercentageRounds(final double percentage) {
- final var blueCircles = max(min((int) ceil(percentage * TOTAL_NUMBER_OF_DOTS), TOTAL_NUMBER_OF_DOTS), 0);
- final var result = new StringBuilder(10);
- for (int i = 0; i < 10; ++i) {
- result.append(i < blueCircles ? "🔵" : "⚪");
- }
- return result.toString();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement