Statement: The material used in this column is written by the VIP students of the Kay Academy, who has the right to be anonymous and has the final right to interpret the article; The Edith Academy is designed to promote students to learn from each other on the basis of public notes.
System classes and mathematical operations classes
Arraycopy (object src, int srcpos, object dest, int destpos, int length), memory array Copy method: Parameter 1 is the array object to be copied (source array); Parameter 2 is the copy from which subscript position of the source array begins The parameter 3 is the copy to the array object (the target array), and the parameter 4 is the data from which position of the target array is copied, and the parameter 5 is the copy length and the number of elements copied.
A copy of an array of memory is half as fast as a circular copy, and the greater the amount of data, the more obvious.
GC (); Promote garbage collection method, System.GC ();
System.getenv () takes out the entire environment variable information collection object, which holds all the environment variable information:
System.getproperties () gets all the system parameters:
System.loadlibrary ("") loads the third-party library.
System.getlogger ("AAA") (jdk1.9 new feature log output):
System.logger Log=system.getlogger ("AAA");
Log.log (System.Logger.Level.INFO, "ASDASDASDASD");
Log.log (System.Logger.Level.WARNING, "ASDASDASDASD");
Log.log (System.Logger.Level.ERROR, "ASDASDASDASD");
System.exit (0); Shutting down a virtual machine
Runtime.getruntime (). exec (); Can execute DOS commands:
When you operate a decimal value, the precision is lost and the result of the operation is incorrect if you follow the normal subtraction mode:
When F1 is of type int, the initial value is 0, add 100 times 0.1, the result is actually 0, and we want the result to be 10.
When F1 is a double type, the initial value is 0 o'clock, the result of adding 100 times 0.1 is 9.99999999999998, which is obviously not the result we want, the theoretical result is 10, the precision is lost after the operation:
How can we avoid this error?
When you want to keep a few numbers in the calculation, multiply them by several numbers, and then divide by the numbers. If you want to keep 10 bits on the 10, you will not lose precision by dividing by 10 and converting to type double.
This calculation is to change the decimal to an int or a long type, and after the calculation, you can restore the float or double type (fast, no memory consumption).
You can also use the BigDecimal class to calculate:
The BigDecimal constructor has two types of initialization parameters: numeric and string.
Results: 88888888888888888888888
The Math class's round () method rounds the decimal point of float and double types:
Operation Result:
15
16
Subtract decimal point: Run result is 15.0
The Jep mathematical operation class is only in JDK9:
System classes and mathematical operations classes