Public static void main (string [] ARGs ){
String STR = NULL;
STR = "Gu Liang ";
System. Out. println ("spell =" + tojp (STR ));
}
Public static string tojp (string c ){
Char [] chars = C. tochararray ();
Stringbuffer sb = new stringbuffer ("");
For (INT I = 0; I <chars. length; I ++ ){
SB. append (getjp (chars [I]);
}
Return sb. tostring (). touppercase ();
}
Public static string getjp (char C)
{
Byte [] array = new byte [2];
Try {
Array = string. valueof (c). getbytes ("GBK ");
} Catch (unsupportedencodingexception e ){
// Todo auto-generated Catch Block
E. printstacktrace ();
}
If (array. Length <2) return string. valueof (C );
Int I = (short) (array [0]-'/0' + 256) * 256 + (short) (array [1]-'/0' + 256 ));
If (I <0xb0a1) return string. valueof (C );
If (I <0xb0c5) Return "";
If (I <0xb2c1) Return "B ";
If (I <0xb4ee) Return "C ";
If (I <0xb6ea) Return "D ";
If (I <0xb7a2) Return "E ";
If (I <0xb8c1) Return "F ";
If (I <0xb9fe) Return "G ";
If (I <0xbbf7) Return "H ";
If (I <0xbfa6) Return "J ";
If (I <0xc0ac) Return "K ";
If (I <0xc2e8) Return "L ";
If (I <0xc4c3) Return "M ";
If (I <0xc5b6) Return "N ";
If (I <0xc5be) Return "O ";
If (I <0xc6da) Return "p ";
If (I <0xc8bb) Return "Q ";
If (I <0xc8f6) Return "R ";
If (I <0 xcbfa) Return "S ";
If (I <0 xcdda) Return "T ";
If (I <0xcef4) Return "W ";
If (I <0xd1b9) Return "X ";
If (I <0xd4d1) Return "Y ";
If (I <0xd7fa) Return "Z ";
Return string. valueof (C );
}