This should have been written before, forgotten, and mended.
This time we talk about how to compute the values of mathematical expressions in Java, for example, we want to calculate sin (PI/3) + cos (PI/6) + 5.6^3, how do we calculate it? Here we need to use the Java math built-in function, the so-called built-in function, is the Java has given you the method, you use the good, sometimes you need to import the package yourself, but math is not, Java will automatically import, do not have to manually import. Let's take a look at this example:
Compile and run through, no problem, this is very simple.
Math.PI, is sent, Math.pow (Z, 3), is to calculate the cubic of Z, Math.sin (x), is sin (x), subtraction these, and mathematics, but some methods and functions need to use the built-in function to achieve, math there are many ways, In this case, it is common to have sqrt (x) (square root), ABS (x) (absolute value), Max (x, y) (maximum in two numbers), min (x, y) (the smallest of two numbers), and so on.
This is relatively simple, is to use Java to express a simple mathematical expression, deep down may be some trouble, but also just because you do not know some of the use of built-in functions, but the truth is very simple, there is a mathematical expression, give you the value of the function, you put the number in, to find the result is good.
Java Beginner: Built-in functions to calculate simple mathematical expressions