Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static final int TOTAL_NUMBER_OF_DOTS = 10;
- private static String getPercentageRounds(final double percentage) {
- final var pot = max(min((int) ceil(percentage * TOTAL_NUMBER_OF_DOTS), TOTAL_NUMBER_OF_DOTS), 0);
- switch (pot) {
- case 0: return "⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪";
- case 1: return "🔵⚪⚪⚪⚪⚪⚪⚪⚪⚪";
- case 2: return "🔵🔵⚪⚪⚪⚪⚪⚪⚪⚪";
- case 3: return "🔵🔵🔵⚪⚪⚪⚪⚪⚪⚪";
- case 4: return "🔵🔵🔵🔵⚪⚪⚪⚪⚪⚪";
- case 5: return "🔵🔵🔵🔵🔵⚪⚪⚪⚪⚪";
- case 6: return "🔵🔵🔵🔵🔵🔵⚪⚪⚪⚪";
- case 7: return "🔵🔵🔵🔵🔵🔵🔵⚪⚪⚪";
- case 8: return "🔵🔵🔵🔵🔵🔵🔵🔵⚪⚪";
- case 9: return "🔵🔵🔵🔵🔵🔵🔵🔵🔵⚪";
- case 10: return "🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵";
- default: return "⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement