me.legrange.console.Percent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of console-animation Show documentation
Show all versions of console-animation Show documentation
A small console animation library
The newest version!
package me.legrange.console;
import static java.lang.String.format;
final class Percent extends Animator {
Percent() {
}
@Override
String draw(N min, N max, N value) {
return format("%.1f%%", calculate(min.doubleValue(), max.doubleValue(), value.doubleValue()));
}
private double calculate(double min, double max, double value) {
value = Math.min(Math.max(value,min), max);
return (value*100) / (max- min);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy