Intel

Developer Zone

Math

java.lang

Class Math



  • public final class Math
    extends Object
    Class Math provides basic math constants and operations such as trigonometric functions, hyperbolic functions, exponential, logarithms, etc.
    • Method Summary

      Methods
      Modifier and Type Method and Description
      static int abs(int i)
      Returns the absolute value of the argument.
      static long abs(long l)
      Returns the absolute value of the argument.
      static int max(int i1, int i2)
      Returns the most positive (closest to positive infinity) of the two arguments.
      static long max(long l1, long l2)
      Returns the most positive (closest to positive infinity) of the two arguments.
      static int min(int i1, int i2)
      Returns the most negative (closest to negative infinity) of the two arguments.
      static long min(long l1, long l2)
      Returns the most negative (closest to negative infinity) of the two arguments.
    • Method Detail

      • abs

        public static int abs(int i)
        Returns the absolute value of the argument.

        If the argument is Integer.MIN_VALUE, Integer.MIN_VALUE is returned.

        Parameters:
        i - the value whose absolute value has to be computed.
        Returns:
        the argument if it is positive, otherwise the negation of the argument.
      • abs

        public static long abs(long l)
        Returns the absolute value of the argument. If the argument is Long.MIN_VALUE, Long.MIN_VALUE is returned.
        Parameters:
        l - the value whose absolute value has to be computed.
        Returns:
        the argument if it is positive, otherwise the negation of the argument.
      • max

        public static int max(int i1,
              int i2)
        Returns the most positive (closest to positive infinity) of the two arguments.
        Parameters:
        i1 - the first argument.
        i2 - the second argument.
        Returns:
        the larger of i1 and i2.
      • max

        public static long max(long l1,
               long l2)
        Returns the most positive (closest to positive infinity) of the two arguments.
        Parameters:
        l1 - the first argument.
        l2 - the second argument.
        Returns:
        the larger of l1 and l2.
      • min

        public static int min(int i1,
              int i2)
        Returns the most negative (closest to negative infinity) of the two arguments.
        Parameters:
        i1 - the first argument.
        i2 - the second argument.
        Returns:
        the smaller of i1 and i2.
      • min

        public static long min(long l1,
               long l2)
        Returns the most negative (closest to negative infinity) of the two arguments.
        Parameters:
        l1 - the first argument.
        l2 - the second argument.
        Returns:
        the smaller of l1 and l2.