1. The system class is used to obtain the property data of the systems commonly used methods: (1) Print array
int int int length); // arrays.tostring (Array)
(2) Current system time ( common )
Currenttimemillis (); // number of milliseconds from 1970 to present
(3) Exiting the Java Virtual machine
Exit (int status); // 0 Normal exit, not 0 abnormal exit. 0;catch in a try block General pass 1
(4) Garbage collection
GC (); // It is recommended that the JVM start the garbage collector garbage collection quickly (the JVM calls the Finalize () method of object to reclaim)
(5) Get environment variables
getenv (String name);
(6) Get System Properties, properties have List Property List property
GetProperties ();
2. Runtime class
Represents the Application Runtime environment
(1) Returns the running environment object for the current application
GetRuntime ();
(2)根据指定的路径执行可执行文件,返回Process对象可用destory()关闭程序
EXEC (String command);
(3)返回jvm空闲的内存
Freememory ();
(4)试图使用的的最大内存
MaxMemory ()
(5)jvm虚拟机的内存总量
TotalMemory ();
3. Date class Dates
Calendar class (not much, not formatted)
Calendar calendar = Calendar. getinstance (); System. Out.println (Cal.get (Calendar. year)); // +1 If you get the month .
Date formatting class SimpleDateFormat ( common )
Role:
(1) Convert the date to the specified format string format ();
Newnew SimpleDateFormat ("yyyy mm month DD day hh" mm min ss sec "= Dateformat.format (date);
(2) Convert the string to the corresponding date parse ()
String str1 = "September 19, 2016 16:30 43 seconds"; // format to be consistent with the above Date date1 = Dateformat.parse (STR1);
4. Math class
Provides a number of mathematical formulas
Ceil: Rounding up the floor: Rounding down Round: rounded random: Generates a stochastic number, greater than or equal to 0.0 less than 1.0
5. Random class
Next generates a random number
// Generate verification Code: Char [] str = {' Medium ', ' country ', ' good ', ' sound ', ' sound ', ' O 'newnew Random (); for int i=0; i<6; i++) {int index = random.nextint (str. length); Sb.append (str[index]);}
3. Java Basic class