*javathe numeric processing class in
1. Overview: There are many ready-made APIsinJava that can be used for numerical processing (mathematical operations) , and programmers will be able to write programs directly using these APIs . The numeric processing classes in Java include:
A) Java.text.NumberFormat class (abstract Class)
- Java.text.
- Java.text.DecimalFormat class: For formatting numbers
- Numeric values can be formatted as integers, floating-point numbers, scientific notation, percentages, etc.
- Can control the accuracy of numbers
- You can add units to numbers
- You need to use a formatted string to indicate the format that you want the value to be rendered in, and theDecimalFormat class defines some special characters, representing different formats, identifying the formatting meanings of the special characters to know how to define the numeric format .
- Use Java.text.DecimalFormat A member method in a class to format a number to display and store
- Program: Eclipse in javatest in Engineering Package Operator_and_math in the Javaapi_decimalformat.java
b) Random class: For random number processing
- The random () function in the Math class can be used to generate
- each function in the random class can also be used for random number processing:
c) Math class: For numerical calculations
- This class contains commonly used mathematical operations, such as trigonometric functions, the reciprocal conversion of angles and radians, exponential functions, rounding functions, maximum, minimum, average, and random number generation methods.
- This class also includes some common mathematical constants, such as PI,E , etc.
- these constants and functions in the math class are static and can be used directly with math. function name and Math. The constant name to invoke.
d) BigInteger class:
- Overview: When you need to process a value that is larger than the maximum value that the int variable can handle 2^31-1 , you need to use BigInteger class to handle numbers of these large values.
E) BigDecimal class:
- Overview: TheBigInteger class handles only integers, while the BigDecimal class can handle large values of any precision
Java Basic---> Digital processing and operations---->java API