In this paper, the realization method of realizing the conversion of Chinese characters into Unicode and the 16 Chinese characters by Java is described. Share to everyone for your reference. The implementation methods are as follows:
First, Chinese characters to Unicode
public static string Tounicode (string s)
{
string as[] = new String[s.length ()];
String S1 = "";
for (int i = 0; i < s.length (); i++)
{
As[i] = integer.tohexstring (S.charat (i) & 0xFFFF );
S1 = S1 + as[i]+ "T";
return
s1;
}
Two, the Chinese character turns 16 to enter the system
public static string Tochinesehex (string s)
{
string ss = S;
byte[] bt = Ss.getbytes ();
String S1 = "";
for (int i = 0; i < bt.length i++)
{
String tempstr = integer.tohexstring (bt[i));
if (Tempstr.length () > 2)
tempstr = tempstr.substring (Tempstr.length ()-2);
S1 = S1 + tempstr + "";
}
return S1.touppercase ();
}