The class in the Java.lang package is not required for import
Wrapper classes for basic data types
There is little difference in the use of packaging class, the use of the method is an integer example
Property:
Max_value Maximum Value
Min_value Minimum value
Construction Method:
Integer t1 = new Integer (123); Constructs an int as an integer
Integer t2 = new Integer ("1234"); Constructs a numeric string as an integer
Integer t3 = 12345;
The difference between a wrapper class and its underlying data type is that the wrapper type consumes more memory than the base type consumes. The wrapper type is an object that can be used with methods. The process of converting a basic type to a wrapper type is called boxing, which in turn is called unpacking.
Common methods:
Integer.parseint ("") converts a string into a number
Integer.paserint ("", 2) converts a string into a number according to the specified binary
Integer.tostring (83); Convert a number to a string
Integer.tostring (83,2); Converts a number to a specified binary string
Integer.tobinarystring (-127); Convert a number to a binary string
Integer.tooctalstring (83); Convert a number to an octal string
Integer.tohexstring (255); Converts a number to a 16-binary string
The result of Ps:integer,paserint (ARG1,ARG2) and integer.tostring (ARG1,ARG2) is 10 binary, one is specified, because the 16 binary is not represented by a number.
The binary is expressed in the form of a complement.
Original code: Decimal directly converted to binary
Complement: Positive complement is the same as the original code
Complement of negative number = inverse Code of the original code corresponding to the positive number +1
Object class
The object class is the parent class of all classes except itself (the root class of the class hierarchy)
Equals (object obj) determines whether two objects are "equal"
Hashcode () Gets the hash code of the object
ToString () Gets the string form of the object
The Equals method of the Ps:object class distinguishes the Equals method of the String class
System Systems Class
SYSTEM.OUT.PRINTLN () Console output statement
SYSTEM.ERR.PRINTLN () Console error output statement (red)
System.exit (0); Normal Exit procedure
System.currenttimemillis () Gets the current time of the system, in milliseconds * (the value returned is the number of milliseconds from 1970.1.1 0:0:0 Day to the current date)
System.arraycopy (src,index,dest,index2,length); Array Copy method
Parameter 1: The original array to be copied
Parameter 2: Start copy of subscript position
Parameter 3: Destination array to hold data
Parameter 4: Subscript to start data in target array
Parameter 5: Number of data to be copied
String/stringbuffer/stringbuilder
String Class
A string is a constant that cannot be changed once it is defined
Essentially a string is a char array
Ps:string is not a basic data type
Common construction methods
String () to create an empty string
String (byte[]); Converts a byte array to a string using the default character set
String (byte[], "GBK"); Converts a byte array to a string using the specified character set
String (byte[],start,length); Converts a byte array from start subscript to lenght bytes to a string
String (byte[], start,length, "GBK")
String (char[]) converts a character array into a string
String (Char[],start,length) converts part of a character array to a string
Common methods
GetBytes (); Convert a string to a byte array using the default character set
GetBytes ("GBK"); Converts a string to a byte array using the specified character set
ToCharArray (); Convert a string to a character array
Length () string [number of characters]
Concat (String) concatenation of strings, equivalent to +
Contains (string) to determine if the string contains a parameter string
Whether EndsWith (string) ends with the specified string
Startwith (string) whether to start with the specified string
Equals (String) compares values for equality
Equalsignorecase (String) compares values for equality, ignoring case
IndexOf (String) determines the first occurrence of a substring in the subscript position, if 1 indicates that the string does not appear
LastIndexOf (String) determines the last subscript position of the substring, if 1 indicates that no
Matches (string) to determine whether a string matches a regular expression
Replace (old,new) replaces substrings with new strings
Split (string) cuts a string based on the specified token
SUBSTRING (start) intercepts the string starting at the specified position
SUBSTRING (start,end) intercepts a string from the specified position to the specified position
Trim () Remove whitespace from the end of the string
toLowerCase (); Convert to lowercase
toUpperCase (); Convert to uppercase
VALUEOF (data) converts data into string types
Ps:
Character set: What are the numbers of the characters that make up the rules
The ISO-8859 series can handle only half-width characters and cannot handle Chinese
gbk/gb2312/gb18030 Simplified Chinese Character set
Big5 Traditional Chinese Character set
UTF-8 Unicode-encoded character set
StringBuilder length variable string, thread insecure
StringBuffer length variable string, is thread-safe,
Performance is worse than StringBuilder.
PS: Use Stingbuffer without thread safety, and when data is in many cases using StringBuilder to consider data security, when the data is small, use string.
Classes commonly used in Java learning--java.lang packages