psdi.util

Class MXMath

  • java.lang.Object
    • psdi.util.MXMath


  • public class MXMath
    extends java.lang.Object
    A utility class to perform calculations using BigDecimal class.
    • Constructor Summary

      Constructors 
      Constructor and Description
      MXMath() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static double abs(double double1)
      Returns the absolute value of the double value.
      static double add(double double1, double double2)
      Adds two double values and returns the result as a double value.
      static int compareTo(double double1, double double2)
      Compares two double values and returns whether the double1 values is less than, equal to or greater than double2 value.
      static double divide(double double1, double double2)
      Divides double2 value from double1 value and returns the result as a double value.
      static double max(double double1, double double2)
      Returns the maximum of two double value.
      static double min(double double1, double double2)
      Returns the minimum of two double value.
      static double multiply(double double1, double double2)
      Multiplies two double values and returns the result as a double value.
      static double negate(double double1)
      Returns the negation of the double value.
      static double subtract(double double1, double double2)
      Subtracts double2 value from double1 value and returns the result as a double value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MXMath

        public MXMath()
    • Method Detail

      • add

        public static double add(double double1,
                                 double double2)
        Adds two double values and returns the result as a double value. This method uses the BigDecimal class to perform the calculation.
      • subtract

        public static double subtract(double double1,
                                      double double2)
        Subtracts double2 value from double1 value and returns the result as a double value. This method uses the BigDecimal class to perform the calculation.
      • multiply

        public static double multiply(double double1,
                                      double double2)
        Multiplies two double values and returns the result as a double value. This method uses the BigDecimal class to perform the calculation.
      • divide

        public static double divide(double double1,
                                    double double2)
        Divides double2 value from double1 value and returns the result as a double value. This method uses the BigDecimal class to perform the calculation. The division result is rounded up in value.
      • abs

        public static double abs(double double1)
        Returns the absolute value of the double value. This method uses the BigDecimal class to perform the calculation.
      • max

        public static double max(double double1,
                                 double double2)
        Returns the maximum of two double value. This method uses the BigDecimal class to perform the calculation.
      • min

        public static double min(double double1,
                                 double double2)
        Returns the minimum of two double value. This method uses the BigDecimal class to perform the calculation.
      • negate

        public static double negate(double double1)
        Returns the negation of the double value. This method uses the BigDecimal class to perform the calculation.
      • compareTo

        public static int compareTo(double double1,
                                    double double2)
        Compares two double values and returns whether the double1 values is less than, equal to or greater than double2 value. Returns a negative number, zero, or a positive number as double1 value is numerically less than, equal to, or greater than double2 value. This method uses the BigDecimal class to perform the calculation.