Package lang_api;/*** in this example, the static method of integer class is used to convert decimal to binary. The hexadecimal string is output and the class is used, * Information of the method runtime of the runtime class, such as the usage of the current class, parent class, package, and memory space. */Public class runtimeinfo {Public String getinfo (Object OBJ) {string result = "value:" + obj. tostring (); If (OBJ instanceof integer) {INTEGER returns bj = (integer) OBJ; int I = returns BJ. intvalue (); Result + = "binary value" + integer. tobinarystring (I) + "hexadecimal value" + integer. tohexstring (I) + "/N";} result + = "OS:" + system. getproperty ("OS. name ") +" Java version: "+ system. getproperty ("Java. VM. version ") +"/N "; Result + =" total memory "+ runtim E. getruntime (). totalmemory () + "available space" + runtime. getruntime (). freememory () + "/N"; return result;} public static void main (string [] ARGs) {runtimeinfo RT = new runtimeinfo (); system. out. println (RT. getinfo (New INTEGER (123); system. out. println (RT. getinfo (new string ("ABC");}/** API class used * Java. lang Language Pack: object class, basic data type package class, system class and runtime class. The following describes these classes: ** object class: Java. lang. object * constructor public obje CT () * Common Methods: * 1> getclass returns the runtime class of this object * 2> Public Boolean equals (Object OBJ) indicates whether another object is "equal" to this object ". * The equals method of the object class implements the maximum possible equality relationship between objects. That is, for any non-null reference values x and y, * This method returns true (x = Y has a value of true) only when x and y reference the same object ). * 3> Public String tostring () returns the string of this object, indicating that its value is equal to: * getclass (). getname () + '@' + integer. tohexstring (hashcode () * class INTEGER: Java. lang. the integer * class encapsulates an int value of the basic type in the object. An integer object contains an int type field. * In addition, this class provides multiple methods that can be converted between the int type and the string type. It also provides other constants and methods that are useful when processing the int type * constructor: * 1> Public INTEGER (INT value): constructs a newly assigned integer object, which indicates the specified int value * 2> Public INTEGER (string S) throws numberformatexception constructs a newly assigned integer object, which indicates the int value indicated by the string * parameter. Convert the string to an int value in the same way as the parseint method (the base value is 10. * Common Methods: * 1> Public static string tohexstring (int I) returns the string representation of an integer parameter in hexadecimal notation (base 16) with an unsigned integer. * integer. tohexstring (n ). touppercase () to uppercase letter * 2> Public static string tooctalstring (int I) to octal (base 8) returns the string representation of an integer parameter in the form of an unsigned integer * 3> Public static string tobinarystring (int I) in binary (base 2) returns the string representation of an integer parameter in the form of an unsigned integer * 4> Public static string tostring (int I) returns a String object that represents a specified integer * returns a String object that represents a specified integer. Convert this parameter to a signed decimal representation and return it as a string. * It is like assigning the parameter and base 10 as the parameter to the tostring (INT, INT) method. * 5> parseint public static int parseint (string S, int Radix) throws numberformatexception * parses the string parameter into a signed integer using the base specified by the second parameter. Except that the first character can be an ASCII minus sign '-' ('/u002d') that represents a negative value, * the characters in a string must be numbers with a specified base (by character. whether digit (char, INT) returns a negative value ). Returns the integer. * If either of the following conditions occurs, a numberformatexception type exception is thrown: * A. The first parameter is null or a string of zero length. * B. The base number is less than character. min_radix or greater than character. max_radix. * C. if the length of a string exceeds 1, except the first character can be minus sign '-' ('u002d '), there are any characters in the string that are not represented by a number of the specified base. * D. The string value is not an int value. * 6> Public static int parseint (string s) parses the string parameter as a signed decimal integer * 7> Public static integer valueof (string S, int Radix) throws numberformatexception * This method returns an integer object equal to the following values: New INTEGER (integer. parseint (S, Radix) * 8> Public static integer valueof (string s) throws numberformatexception * This method returns an integer object equal to the following values: New INTEGER (integer. parseint (s) * 9> Public static integer valueof (int I) returns an int Value integer instance * if a new integer instance is not required, this method should be used first, instead of constructing the integer (INT) method ), * This method may significantly improve the space and time performance by caching frequently requested values. * 10> return value of public byte bytevalue (): The value represented by this object is converted to byte type, and the value of this integer is returned as byte type * 11> Public short partial value () return the value of this Integer as short * 12> Public int intvalue () returns the value of this Integer as int * 13> Public long longvalue () return the value of this Integer as long * 14> public float floatvalue () return the value of this Integer as float * 15> Public double doublevalue () returns the string representation of the integer value * 16> Public String tostring () of the object value (base 10) as a double type. Formula * 17> Public static integer getinteger (string nm) determines the integer * 18> Public int compareto (integer anotherinteger) with the system attribute of the specified name) compare two integer objects X class runtime: Java. lang. the runtime public class runtimeextends object application cannot create its own runtime class instance * Common method: * 1> Public static runtime getruntime () returns runtime objects related to the current Java application. Most methods of the runtime class are instance methods, * and must be called based on the current runtime object. * 2> Public void exit (INT status) terminates the currently running Java Virtual Machine by starting the VM close sequence. * The system. Exit method is a traditional and convenient method to call this method. * 3> Public long totalmemory () returns the total memory in the Java Virtual Machine. The value returned by this method may change over time, depending on the host environment. * 4> Public long freememory () returns the amount of free memory in the Java Virtual Machine. Calling the GC method may increase the return value of freememory * 5> Public int availableprocessors () returns the number of available processors to the Java Virtual Machine * 6> Public long maxmemory () returns the maximum amount of memory that the Java Virtual Machine is trying to use. If the memory itself has no limit, the return value is long. max_value, in bytes * 7> Public void GC () to run the garbage collector. Calling this method means that the Java Virtual Machine has made some efforts to recycle unused objects, so that the memory occupied by these objects can be reused quickly. * When the control is returned from the method call, the virtual machine has done its best to recycle all discarded objects. * 8> Public void load (string filename) is loaded as the specified file name of the dynamic library. The file name variable must be a complete path name * (for example, runtime. getruntime (). Load ("/home/AVH/lib/libx11.so ");). * Class system: the java. Lang. system class contains some useful class fields and methods. It cannot be instantiated. * 1> Public static void setsecuritymanager (securitymanager s) set system security * 2> Public static securitymanager getsecuritymanager () to obtain the system security interface. * 3> Public static long currenttimemillis () returns the current time in milliseconds. The time difference between the current time and the Coordinated Universal Time at midnight, January 1, January 1, 1970 (measured in milliseconds ). * 4> Public static void arraycopy (Object SRC, int srcpos, object DEST, int destpos, int length) * copy an array from the specified source array and start from the specified position, ends at the specified position of the target array. * 5> Public static properties getproperties () determines the current system attribute. * 6> set the system property to the properties parameter * 7> Public static string getproperty (string key, string DEF) in public static void setproperties (properties props) obtains the system attributes described with the specified key. * Description of key-related values: Java. version Java Runtime Environment version Java. java. vendor. URL Java vendor URL Java. home Java installation directory Java. VM. specification. version Java Virtual Machine Specification Version Java. VM. specification. java. VM. specification. name Java virtual machine specification name Java. VM. version Java Virtual Machine implementation version Java. VM. java. VM. name Java Virtual Machine implementation name Java. specification. version Java Runtime Environment Specification Version Java. specification. vendor Java Runtime Environment Java. specification. name Java Runtime Environment specification name Java. class. version Java class format version number Java. class. path Java class path Java. library. the path list searched when the path is loaded. java. io. the default temporary file path of tmpdir is Java. name of the JIT compiler to be used by compiler Java. ext. path of one or more extended directories in dirs OS. name OS. arch operating system architecture OS. version: The version file of the operating system. the separator of the separator file ("/" in UNIX) path. separator path separator (":" in UNIX systems) line. separator line separator ("/n" in UNIX) user. name User's account name user. h Ome user's main directory user. dir user's current working directory * 8> Public static string setproperty (string key, string value) set the system property indicated by the specified key * 9> Public static string getproperty (string key) obtain the system attribute * 10> Public static void runfinalization () for running all objects in the suspended and terminated state. * 11> Public static void load (string filename) load Code files from the local file system that acts as a dynamic library with the specified file name. The file name parameter must be the complete path * 12> Public static void loadlibrary (string libname) to load the system library specified by the libname parameter. The method to map the database name to the actual system database depends on the system */