Package de.florianmichael.rclasses.math
Class Percentage
java.lang.Object
de.florianmichael.rclasses.math.Percentage
Implementation of a percentage calculator.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doublebase(double percentageDecimal, double value) Calculates the base value of a given percentage.static floatbase(float percentageDecimal, float value) Calculates the base value of a given percentage.static doublepercentage(double value, double base) Calculates the percentage of a given value.static floatpercentage(float value, float base) Calculates the percentage of a given value.static doubletoDecimal(double percentage) Converts a percentage to a decimal.static floattoDecimal(float percentage) Converts a percentage to a decimal.static doubletoPercentage(double decimal) Converts a decimal to a percentage.static floattoPercentage(float decimal) Converts a decimal to a percentage.static doublevalue(double percentageDecimal, double base) Calculates the percentage value of a given base.static floatvalue(float percentageDecimal, float base) Calculates the percentage value of a given base.
-
Constructor Details
-
Percentage
public Percentage()
-
-
Method Details
-
value
public static float value(float percentageDecimal, float base) Calculates the percentage value of a given base.- Parameters:
percentageDecimal- The percentage as decimal.base- The base value.- Returns:
- The percentage value.
-
base
public static float base(float percentageDecimal, float value) Calculates the base value of a given percentage.- Parameters:
percentageDecimal- The percentage as decimal.value- The percentage value.- Returns:
- The base value.
-
percentage
public static float percentage(float value, float base) Calculates the percentage of a given value.- Parameters:
value- The percentage value.base- The base value.- Returns:
- The percentage.
-
toDecimal
public static float toDecimal(float percentage) Converts a percentage to a decimal.- Parameters:
percentage- The percentage.- Returns:
- The decimal.
-
toPercentage
public static float toPercentage(float decimal) Converts a decimal to a percentage.- Parameters:
decimal- The decimal.- Returns:
- The percentage.
-
value
public static double value(double percentageDecimal, double base) Calculates the percentage value of a given base.- Parameters:
percentageDecimal- The percentage as decimal.base- The base value.- Returns:
- The percentage value.
-
base
public static double base(double percentageDecimal, double value) Calculates the base value of a given percentage.- Parameters:
percentageDecimal- The percentage as decimal.value- The percentage value.- Returns:
- The base value.
-
percentage
public static double percentage(double value, double base) Calculates the percentage of a given value.- Parameters:
value- The percentage value.base- The base value.- Returns:
- The percentage.
-
toDecimal
public static double toDecimal(double percentage) Converts a percentage to a decimal.- Parameters:
percentage- The percentage.- Returns:
- The decimal.
-
toPercentage
public static double toPercentage(double decimal) Converts a decimal to a percentage.- Parameters:
decimal- The decimal.- Returns:
- The percentage.
-