Java Math Class

Source: Internet
Author: User

1  Packagedemo04;2 3 //all methods of the math class are static methods, and direct class names are called4  Public classMathdemo {5      Public Static voidMain (string[] args) {6         7         //static int abs (int a) returns the absolute value of int8System.out.println (Math.Abs (-1));//19         Ten         //static Double Ceil (double A) rounding up OneSystem.out.println (Math.ceil (5.1));//6.0 A          -         //static double floor (double a) rounding down -System.out.println (Math.floor (5.1));//5.0 the          -         //static Double pow (double A, double b) A's B-square -System.out.println (Math.pow (2, 3));//8.0 -          +         //static double sqrt (double A) -System.out.println (MATH.SQRT (4));//2.0 +          A         //static double random () number [0.0,1.0] at System.out.println (Math.random ()); -          -         //Static Long round (double a) rounded rounding -System.out.println (Math.Round (1.5));//2 -           -     } in } -         

Java 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.