Java.lang.Math

Source: Internet
Author: User
Tags abs pow

Package Com.etc.usual;public class Testmath {public static void main (string[] args) {//TODO auto-generated method stub//Word Segment Summary System.out.println (MATH.PI);//3.141592653589793system.out.println (MATH.E); 2.718281828459045//abs System.out.println ("Math.Abs ( -100):" +math.abs ( -100));//math.abs ( -100): 100//CBRT (double A) returns the cube root of the double value. System.out.println ("MATH.CBRT (8.0):" +MATH.CBRT (8)),//MATH.CBRT (8.0): 2.0//ceil (Double A) returns the smallest (nearest negative infinity) Double value, The value is greater than or equal to the parameter and equals an integer. System.out.println ("Math.ceil (1.3):" +math.ceil (1.3)); Math.ceil (1.3): 2.0//floor (Double A) returns the largest (closest to positive infinity) Double value, which is less than or equal to the parameter and equals an integer. System.out.println ("Math.floor (1.3):" +math.floor (1.3));//math.floor (1.3): 1.0//max (int a, int b) returns two int The larger of a System.out.println ("Math.max (5,20):" +math.max (5,20)),//math.max (5,20): 20//nested System.out.println (Math.max (Math.max (5,11), 20)); /20//min (int a, int b) returns the smaller of the two int values. System.out.println ("Math.min (5,20):" +math.min (5,20));//math.min (5,20): 5//pow (Double A, double b) Returns the value of the second argument to the power of the first parameter. System. Out.println ("Math.pow (2,3):" +math.pow (2,3)),//2 3-time Math.pow (2,3): 8.0//random () returns a double with a positive number, which is greater than or equal to 0.0 and less than 1.0. System.out.println ("Math.random ():" +math.random ());//math.random (): 0.9297624078518352//round (Double A) returns the nearest parameter Long System.out.println ("Math.Round (1.3):" +math.round (1.3));//math.round (1.3): 1system.out.println ("Math.Round (1.5): "+math.round (1.5));//math.round (1.5): 2}}

  

Java.lang.Math

Related Article

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.