The constructor String(byte[]) of the String class constructs a string object using the specified byte array.
The String(byte[],int offset,int length) construction method uses a part of the specified byte array, that is, length bytes starting from the array's starting position offset, to construct a string object.
The public byte[] getBytes() method uses the platform's default character encoding to convert the current string into a byte array.
public byte[] getBytes(String charsetName) uses parameters to specify the character encoding and converts the current string into a byte array.
If the platform's default character encoding is GB_2312 (national standard, simplified Chinese), then calling the getBytes() method is equivalent to calling getBytes(GB2312).
Note : getBytes(String charsetName) with parameters throws UnsupportedEncodingException, therefore, getBytes(String charsetName) must be called in a try-catch statement.