Java's math class

Source: Internet
Author: User
Tags pow square root

1  Public classDemo1_math {2 3     /*4 * The Math class contains methods for performing basic mathematical operations, such as: exponential, logarithmic, square root, etc.5 * All methods in math are static, and construction methods are private6 * public static int abs (int a) to find the absolute value of a number7 * public static double ceil (double A) rounding up, returning a double value8 * public static double floor (double b) rounded down, returning a double value9 * public static int max (int a, int b) takes a large value of two and Min is similar to Max, taking the minimum valueTen * public static int pow (double A, double b) to power a double value One * public static double random () takes a [0.0,1.0] between a double A * public static int round (float a) rounding - * public static double sqrt (double a) open square for a double number -      */ the      Public Static voidMain (string[] args) { -System.out.println (Math.Abs (-10)); -System.out.println (Math.ceil (12.7)); -System.out.println (Math.floor (12.6)); +System.out.println (Math.max (1, 9)); -System.out.println (Math.pow (6.0, 2.0)); + System.out.println (Math.random ()); ASystem.out.println (Math.Round (3.15)); atSystem.out.println (MATH.SQRT (9)); -         /* - * Operation results are as follows: - * Ten - 13.0 - 12.0 in 9 - 36.0 to 0.2989099810206127 + 3 - 3.0 the          */ *     } $}

Java's math class

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.