Class Percentage

java.lang.Object
de.florianmichael.rclasses.math.Percentage

public class Percentage extends Object
Implementation of a percentage calculator.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    base(double percentageDecimal, double value)
    Calculates the base value of a given percentage.
    static float
    base(float percentageDecimal, float value)
    Calculates the base value of a given percentage.
    static double
    percentage(double value, double base)
    Calculates the percentage of a given value.
    static float
    percentage(float value, float base)
    Calculates the percentage of a given value.
    static double
    toDecimal(double percentage)
    Converts a percentage to a decimal.
    static float
    toDecimal(float percentage)
    Converts a percentage to a decimal.
    static double
    toPercentage(double decimal)
    Converts a decimal to a percentage.
    static float
    toPercentage(float decimal)
    Converts a decimal to a percentage.
    static double
    value(double percentageDecimal, double base)
    Calculates the percentage value of a given base.
    static float
    value(float percentageDecimal, float base)
    Calculates the percentage value of a given base.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.