java.lang.Object
com.github.ushiosan23.jvm.base.MathExtra
-
Method Summary
Modifier and TypeMethodDescriptionstatic doubleclamp(double value, double min, double max) This method clamp a number within a range of numbers.static doublepercentage(double value, double percentage) Find the percent of a number.
-
Method Details
-
clamp
public static double clamp(double value, double min, double max) This method clamp a number within a range of numbers. If the value is greater than the range, it returns the highest number and not the overflow number. If the value is less than the range, it returns the smallest number and not the overflow number.- Parameters:
value- Value to analyzemin- Minimum range valuemax- Maximum range value- Returns:
- Returns a value within the given range
-
percentage
public static double percentage(double value, double percentage) Find the percent of a number.- Parameters:
value- Base valuepercentage- Percentage to calculate- Returns:
- Returns a percentage of a number
-