Import Java.util.Collections; Import Java.util.iterator; import Java.util.linkedhashMap; import Java.util.map; / ** * 将汉字转化为全拼 */ öffentliche Klasse cntospell1 {private statische Karte <String, Integer> Spellmap = null; // 存放生僻字和其拼音的 Map Private Static Map <Zeichen, Zeichenfolge> ungewordsmap = null; static {if (Spellmap == null) {Spellmap = collections.synchronizedMap (neu LinkedHashMap <String, Integer> (396)); UncommonwordSmap = Collections.synchronizedMap (New LinkedHasMap <Zeichen, String> (200)); } initialize (); initunnonwords (); } private cntospell1 () {} / ** * 初始化 * / private static void initialize () {Spellmap.put ("'a", -20319); Spellmap.put ("'ai", -20317); Spellmap.put ("'und", -20304); Spellmap.put ("'Ang", -20295); Spellmap.put ("'ao", -20292); tellmap.put ("ba", -20283); Spellmap.put ("Bai", -20265); Spellmap.put ("Ban", -20257); Spellmap.put ("Bang", -20242); Spellmap.put ("Bao", -20230); Spellmap.put ("Bei", -20051); Spellmap.put ("Ben", -20036); Spellmap.put ("Beng", -20032); tellmap.put ("bi", -20026); Spellmap.put ("Bian", -20002); tellmap.put ("biao", -19990); tellmap.put ("bie", -19986); Spellmap.put ("bin", -19982); Spellmap.put ("Bing", -19976); tellmap.put ("bo", -19805); tellmap.put ("bu", -19784); Spellmap.put ("CA", -19775); Spellmap.put ("Cai", -19774); Spellmap.put ("Can", -19763); Spellmap.put ("CANG", -19756); Spellmap.put ("CAO", -19751); Spellmap.put ("CE", -19746); Spellmap.put ("Ceng", -19741); Spellmap.put ("Cha", -19739); Spellmap.put ("Chai", -19728); Spellmap.put ("Chan", -19725); Spellmap.put ("Chang", -19715); Spellmap.put ("Chao", -19540); Spellmap.put ("Che", -19531); Spellmap.put ("Chen", -19525); Spellmap.put ("Cheng", -19515); Spellmap.put ("Chi", -19500); Spellmap.put ("Chong", -19484); Spellmap.put ("Chou", -19479); Spellmap.put ("Chu", -19467); Spellmap.put ("Chuai", -19289); Spellmap.put ("Chuan", -19288); Spellmap.put ("Chuang", -19281); Spellmap.put ("Chui", -19275); Spellmap.put ("Chun", -19270); Spellmap.put ("Chuo", -19263); Spellmap.put ("CI", -19261); tellmap.put ("cong", -19249); Spellmap.put ("cou", -19243); Spellmap.put ("Cu", -19242); Spellmap.put ("Cuan", -19238); Spellmap.put ("Cui", -19235); Spellmap.put ("Cun", -19227); tellmap.put ("cuo", -19224); Spellmap.put ("da", -19218); Spellmap.put ("Dai", -19212); Spellmap.put ("Dan", -19038); Spellmap.put ("Dang", -19023); Spellmap.put ("Dao", -19018); tellmap.put ("de", -19006); Spellmap.put ("Deng", -19003); tellmap.put ("di", -18996); Spellmap.put ("Dian", -18977); Spellmap.put ("Diao", -18961); Spellmap.put ("Die", -18952); Spellmap.put ("Ding", -18783); Spellmap.put ("DiU", -18774); Spellmap.put ("Dong", -18773); Spellmap.put ("Dou", -18763); Spellmap.put ("du", -18756); Spellmap.put ("Duan", -18741); Spellmap.put ("DUI", -18735); Spellmap.put ("Dun", -18731); Spellmap.put ("Duo", -18722); tellmap.put ("'e", -18710); Spellmap.put ("'en", -18697); Spellmap.put ("'er", -18696); tellmap.put ("fa", -18526); Spellmap.put ("Fan", -18518); Spellmap.put ("Fang", -18501); tellmap.put ("fei", -18490); tellmap.put ("fen", -18478); Spellmap.put ("Feng", -18463); Spellmap.put ("fo", -18448); tellmap.put ("fou", -18447); tellmap.put ("fu", -18446); tellmap.put ("ga", -18239); tellmap.put ("gai", -18237); Spellmap.put ("Gan", -18231); Spellmap.put ("Gang", -18220); tellmap.put ("gao", -18211); Spellmap.put ("Ge", -18201); Spellmap.put ("Gei", -18184); Spellmap.put ("Gen", -18183); Spellmap.put ("Geng", -18181); Spellmap.put ("Gong", -18012); Spellmap.put ("gou", -17997); Spellmap.put ("Gu", -17988); Spellmap.put ("Gua", -17970); Spellmap.put ("Guai", -17964); Spellmap.put ("Guan", -17961); Spellmap.put ("Guang", -17950); Spellmap.put ("GUI", -17947); Spellmap.put ("Gun", -17931); Spellmap.put ("Guo", -17928); tellmap.put ("ha", -17922); tellmap.put ("hai", -17759); Spellmap.put ("Han", -17752); Spellmap.put ("Hang", -17733); Spellmap.put ("Hao", -17730); Spellmap.put ("He", -17721); Spellmap.put ("Hei", -17703); Spellmap.put ("Hen", -17701); Spellmap.put ("Heng", -17697); Spellmap.put ("Hong", -17692); Spellmap.put ("Hou", -17683); Spellmap.put ("Hu", -17676); Spellmap.put ("Hua", -17496); Spellmap.put ("Huai", -17487); Spellmap.put ("Huan", -17482); Spellmap.put ("Huang", -17468); Spellmap.put ("Hui", -17454); Spellmap.put ("Hun", -17433); Spellmap.put ("Huo", -17427); Spellmap.put ("ji", -17417); tellmap.put ("jia", -17202); Spellmap.put ("Jian", -17185); Spellmap.put ("Jiang", -16983); Spellmap.put ("Jiao", -16970); Spellmap.put ("jie", -16942); Spellmap.put ("Jin", -16915); Spellmap.put ("Jing", -16733); Spellmap.put ("Jiong", -16708); tellmap.put ("jiu", -16706); Spellmap.put ("Ju", -16689); Spellmap.put ("Juan", -16664); Spellmap.put ("jue", -16657); Spellmap.put ("Jun", -16647); tellmap.put ("ka", -16474); Spellmap.put ("Kai", -16470); tellmap.put ("kan", -16465); Spellmap.put ("Kang", -16459); tellmap.put ("kao", -16452); Spellmap.put ("ke", -16448); Spellmap.put ("Ken", -16433); Spellmap.put ("Keng", -16429); Spellmap.put ("Kong", -16427); Spellmap.put ("Kou", -16423); tellmap.put ("ku", -16419); tellmap.put ("kua", -16412); tellmap.put ("kuai", -16407); tellmap.put ("kuan", -16403); tellmap.put ("kuang", -16401); Spellmap.put ("kui", -16393); tellmap.put ("kun", -16220); Spellmap.put ("kuo", -16216); Spellmap.put ("la", -16212); Spellmap.put ("Lai", -16205); tellmap.put ("lan", -16202); Spellmap.put ("Lang", -16187); tellmap.put ("lao", -16180); Spellmap.put ("le", -16171); Spellmap.put ("Lei", -16169); Spellmap.put ("Leng", -16158); Spellmap.put ("li", -16155); tellmap.put ("lia", -15959); tellmap.put ("lian", -15958); Spellmap.put ("Liang", -15944); tellmap.put ("liao", -15933); Spellmap.put ("Lie", -15920); Spellmap.put ("Lin", -15915); Spellmap.put ("Ling", -15903); tellmap.put ("liu", -15889); tellmap.put ("long", -15878); Spellmap.put ("Lou", -15707); Spellmap.put ("lu", -15701); tellmap.put ("lv", -15681); tellmap.put ("luan", -15667); Spellmap.put ("lue", -15661); tellmap.put ("lun", -15659); tellmap.put ("luo", -15652); Spellmap.put ("ma", -15640); Spellmap.put ("mai", -15631); Spellmap.put ("Mann", -15625); Spellmap.put ("Mang", -15454); tellmap.put ("mao", -15448); tellmap.put ("me", -15436); tellmap.put ("mei", -15435); Spellmap.put ("Männer", -15419); Spellmap.put ("Meng", -15416); tellmap.put ("mi", -15408); Spellmap.put ("Mian", -15394); tellmap.put ("miao", -15385); Spellmap.put ("Mie", -15377); Spellmap.put ("min", -15375); tellmap.put ("ming", -15369); Spellmap.put ("miu", -15363); Spellmap.put ("Mo", -15362); Spellmap.put ("MoU", -15183); Spellmap.put ("mu", -15180); tellmap.put ("na", -15165); Spellmap.put ("Nai", -15158); tellmap.put ("nan", -15153); Spellmap.put ("Nang", -15150); Spellmap.put ("Nao", -15149); Spellmap.put ("Ne", -15144); tellmap.put ("nei", -15143); Spellmap.put ("nen", -15141); Spellmap.put ("Neng", -15140); Spellmap.put ("Ni", -15139); Spellmap.put ("Nian", -15128); Spellmap.put ("Niang", -15121); Spellmap.put ("Niao", -15119); tellmap.put ("nie", -15117); Spellmap.put ("nin", -15110); Spellmap.put ("Ning", -15109); Spellmap.put ("NIU", -14941); tellmap.put ("nong", -14937); Spellmap.put ("nu", -14933); tellmap.put ("nv", -14930); tellmap.put ("nuan", -14929); Spellmap.put ("Nue", -14928); tellmap.put ("nuo", -14926); Spellmap.put ("'o", -14922); Spellmap.put ("'ou", -14921); tellmap.put ("pa", -14914); tellmap.put ("pai", -14908); Spellmap.put ("Pan", -14902); Spellmap.put ("Pang", -14894); tellmap.put ("pao", -14889); tellmap.put ("pei", -14882); tellmap.put ("pen", -14873); tellmap.put ("peng", -14871); tellmap.put ("pi", -14857); Spellmap.put ("Klavier", -14678); tellmap.put ("piao", -14674); Spellmap.put ("Pie", -14670); Spellmap.put ("Pin", -14668); Spellmap.put ("Ping", -14663); tellmap.put ("po", -14654); Spellmap.put ("Pu", -14645); tellmap.put ("qi", -14630); Spellmap.put ("Qia", -14594); Spellmap.put ("Qian", -14429); Spellmap.put ("Qiang", -14407); Spellmap.put ("Qiao", -14399); Spellmap.put ("Qie", -14384); Spellmap.put ("Qin", -14379); Spellmap.put ("Qing", -14368); Spellmap.put ("Qiong", -14355); tellmap.put ("qiu", -14353); Spellmap.put ("qu", -14345); Spellmap.put ("Quan", -14170); Spellmap.put ("Que", -14159); Spellmap.put ("Qun", -14151); Spellmap.put ("Ran", -14149); Spellmap.put ("Rang", -14145); tellmap.put ("rao", -14140); Spellmap.put ("re", -14137); Spellmap.put ("Ren", -14135); Spellmap.put ("reng", -14125); tellmap.put ("ri", -14123); Spellmap.put ("Rong", -14122); Spellmap.put ("Rou", -14112); Spellmap.put ("Ru", -14109); Spellmap.put ("Ruan", -14099); Spellmap.put ("rui", -14097); Spellmap.put ("run", -14094); Spellmap.put ("Ruo", -14092); Spellmap.put ("SA", -14090); Spellmap.put ("Sai", -14087); tellmap.put ("san", -14083); tellmap.put ("sang", -13917); Spellmap.put ("Sao", -13914); Spellmap.put ("SE", -13910); tellmap.put ("sen", -13907); tellmap.put ("seng", -13906); tellmap.put ("sha", -13905); Spellmap.put ("Shai", -13896); Spellmap.put ("Shan", -13894); Spellmap.put ("Shang", -13878); Spellmap.put ("Shao", -13870); Spellmap.put ("She", -13859); Spellmap.put ("Shen", -13847); Spellmap.put ("Sheng", -13831); Spellmap.put ("Shi", -13658); Spellmap.put ("shou", -13611); Spellmap.put ("Shu", -13601); Spellmap.put ("Shua", -13406); Spellmap.put ("Shuai", -13404); Spellmap.put ("Shuan", -13400); Spellmap.put ("Shuang", -13398); Spellmap.put ("Shui", -13395); Spellmap.put ("Shun", -13391); Spellmap.put ("Shuo", -13387); Spellmap.put ("si", -13383); Spellmap.put ("Song", -13367); Spellmap.put ("Sou", -13359); Spellmap.put ("Su", -13356); Spellmap.put ("Suan", -13343); Spellmap.put ("Sui", -13340); tellmap.put ("sun", -13329); Spellmap.put ("Suo", -13326); tellmap.put ("ta", -13318); Spellmap.put ("Tai", -13147); Spellmap.put ("Tan", -13138); Spellmap.put ("Tang", -13120); Spellmap.put ("Tao", -13107); tellmap.put ("te", -13096); Spellmap.put ("Teng", -13095); tellmap.put ("ti", -13091); Spellmap.put ("Tian", -13076); Spellmap.put ("Tiao", -13068); Spellmap.put ("Tie", -13063); Spellmap.put ("Ting", -13060); Spellmap.put ("Tong", -12888); Spellmap.put ("tou", -12875); Spellmap.put ("Tu", -12871); Spellmap.put ("Tuan", -12860); tellmap.put ("tui", -12858); Spellmap.put ("Tun", -12852); Spellmap.put ("Tuo", -12849); Spellmap.put ("WA", -12838); tellmap.put ("wai", -12831); Spellmap.put ("Wan", -12829); Spellmap.put ("Wang", -12812); Spellmap.put ("Wei", -12802); Spellmap.put ("Wen", -12607); Spellmap.put ("Weng", -12597); Spellmap.put ("wo", -12594); Spellmap.put ("Wu", -12585); Spellmap.put ("xi", -12556); tellmap.put ("xia", -12359); tellmap.put ("xian", -12346); Spellmap.put ("Xiang", -12320); Spellmap.put ("xiao", -12300); Spellmap.put ("xie", -12120); Spellmap.put ("xin", -12099); Spellmap.put ("Xing", -12089); Spellmap.put ("Xiong", -12074); Spellmap.put ("xiu", -12067); Spellmap.put ("xu", -12058); tellmap.put ("xuan", -12039); Spellmap.put ("Xue", -11867); Spellmap.put ("Xun", -11861); Spellmap.put ("ya", -11847); Spellmap.put ("yan", -11831); tellmap.put ("yang", -11798); tellmap.put ("yao", -11781); Spellmap.put ("ye", -11604); Spellmap.put ("yi", -11589); tellmap.put ("yin", -11536); tellmap.put ("ying", -11358); tellmap.put ("yo", -11340); Spellmap.put ("Yong", -11339); Spellmap.put ("You", -11324); tellmap.put ("yu", -11303); Spellmap.put ("Yuan", -11097); tellmap.put ("yue", -11077); Spellmap.put ("yun", -11067); Spellmap.put ("Za", -11055); Spellmap.put ("Zai", -11052); Spellmap.put ("Zan", -11045); Spellmap.put ("Zang", -11041); Spellmap.put ("Zao", -11038); Spellmap.put ("Ze", -11024); Spellmap.put ("Zei", -11020); Spellmap.put ("Zen", -11019); Spellmap.put ("Zeng", -11018); Spellmap.put ("Zha", -11014); Spellmap.put ("Zhai", -10838); Spellmap.put ("Zhan", -10832); Spellmap.put ("Zhang", -10815); Spellmap.put ("Zhao", -10800); Spellmap.put ("zhe", -10790); Spellmap.put ("Zhen", -10780); Spellmap.put ("Zheng", -10764); Spellmap.put ("Zhi", -10587); Spellmap.put ("Zhong", -10544); Spellmap.put ("Zhou", -10533); Spellmap.put ("Zhu", -10519); Spellmap.put ("Zhua", -10331); Spellmap.put ("Zhuai", -10329); Spellmap.put ("Zhuan", -10328); Spellmap.put ("Zhuang", -10322); Spellmap.put ("Zhui", -10315); Spellmap.put ("Zhun", -10309); Spellmap.put ("Zhuo", -10307); Spellmap.put ("Zi", -10296); Spellmap.put ("Zong", -10281); Spellmap.put ("Zou", -10274); Spellmap.put ("Zu", -10270); Spellmap.put ("Zuan", -10262); Spellmap.put ("Zui", -10260); Spellmap.put ("Zun", -10256); Spellmap.put ("Zuo", -10254); } /** * 添加生僻字 * @param cnord 生僻字 * @param zauber 生僻字的拼音, 如果拼音以 a, o, e 开头 请将开头分别改为 请将开头分别改为 'a,' o, 'e , 如 :安. } / ** * 初始化生僻字 * / private static void inituncommonwords () {putUnCommonword ('', "ao"); putUnCommonword ('灞', "ba"); PutCommonWord ('', "Ben"); putUnCommonword ('', "biao"); putUnCommonword ('', "biao"); PutCommonWord ('杈', "Cha"); PutCommonWord ('', "Chen"); PutCommonWord ('', "Cheng"); putUnCommonword ('魑', "chi"); PutCommonWord ('', "Chong"); PutCommonWord ('', "Chong"); PutCommonWord ('', "Cu"); putUnCommonWord ('毳', "cui"); putUnCommonword ('', "Fang"); putUnCommonword ('沣', "feng"); putUnCommonword ('', "gou"); PutCommonWord ('焓', "Han"); putCommonWord ('', "Han"); PutCommonWord ('晗', "Han"); putCommonWord ('', "Han"); PutCommonWord ('翮', "er"); PutCommonWord ('', "er"); PutCommonWord ('', "Huan"); PutCommonWord ('', "Hui"); putUnCommonword ('', "jie"); putUnCommonword ('', "Jing"); putUnCommonword ('', "Jing"); putUnCommonword ('', "Jing"); putUnCommonword ('', "kun"); putUnCommonword ('琨', "kun"); putUnCommonword ('', "kun"); putUnCommonword ('骊', "li"); putUnCommonword ('鎏', "liu"); putUnCommonword ('', "Mann"); PutCommonWord ('', "mei"); putUnCommonword ('淼', "miao"); putUnCommonword ('', "nan"); putUnCommonword ('', "nan"); putUnCommonword ('甯', "ning"); putUnCommonword ('', "ning"); putUnCommonword ('', "pa"); putUnCommonword ('', "pi"); PutCommonWord ('', "Qian"); putUnCommonword ('', "qin"); putUnCommonword ('', "qing"); putUnCommonword ('', "qing"); putUnCommonword ('', "qing"); putUnCommonword ('', "qing"); putUnCommonword ('', "qing"); putUnCommonword ('悫', "que"); putUnCommonword ('', "que"); putUnCommonword ('', "rong"); PutCommonWord ('', "Shen"); PutCommonWord ('', "Shen"); PutCommonWord ('', "Shen"); PutCommonWord ('', "Sheng"); PutCommonWord ('', "Sheng"); PutCommonWord ('晟', "Sheng"); PutCommonWord ('', "Sheng"); PutCommonWord ('眚', "Sheng"); PutCommonWord ('', "Sheng"); PutCommonWord ('', "Sheng"); PutCommonWord ('', "Sheng"); PutCommonWord ('', "Sheng"); putUnCommonword ('', "Shi"); putUnCommonword ('', "su"); putUnCommonword ('', "tao"); PutCommonWord ('', "Tian"); PutCommonWord ('仝', "Tong"); PutCommonWord ('', "Wei"); PutCommonWord ('炜', "Wei"); PutCommonWord ('玮', "Wei"); PutCommonWord ('', "Wu"); putUnCommonword ('邬', "Wu"); putUnCommonword ('', "xi"); putUnCommonword ('', "xian"); putUnCommonword ('', "xiao"); putUnCommonword ('', "xiao"); putUnCommonword ('筱', "xiao"); putUnCommonword ('勰', "xie"); putUnCommonword ('忻', "xin"); putUnCommonword ('庥', "xiu"); putUnCommonword ('', "xu"); putUnCommonword ('', "xu"); putUnCommonword ('', "xu"); putUnCommonword ('', "xuan"); putUnCommonword ('煊', "xuan"); putUnCommonword ('', "xuan"); putUnCommonword ('', "xuan"); putUnCommonword ('暄', "xuan"); putUnCommonword ('娅', "ya"); putUnCommonWord ('琰', "yan"); putUnCommonWord ('妍', "yan"); putUnCommonWord ('焱', "yan"); putUnCommonword ('', "yang"); putUnCommonword ('', "yang"); putUnCommonword ('', "yang"); putUnCommonword ('', "yao"); putUnCommonword ('', "yao"); putUnCommonword ('怡', "yi"); putUnCommonword ('', "yi"); putUnCommonword ('', "yi"); putUnCommonword ('', "yi"); putUnCommonword ('瑛', "ying"); putUnCommonword ('', "ying"); putUnCommonword ('', "ying"); putUnCommonword ('', "ying"); putUnCommonword ('滢', "ying"); putUnCommonword ('', "ying"); putUnCommonword ('莜', "du"); putUnCommonword ('昱', "yu"); putUnCommonword ('', "yun"); putUnCommonword ('', "zhe"); putUnCommonword ('', "zhe"); PutCommonWord ('', "Zhi"); } /*** 获得单个汉字的 ascii. * @param cn 汉字字符 * @return 汉字对应的 ascii, 错误时返回 0 */ public static int getCnascii (char cn) {byte [] bytes = (string.Valueof (cn)). getBytes (); if (bytes == null || bytes.length == 0 || bytes.length> 2) {// 错误 return 0; } if (bytes.length == 1) {// 英文字符 return bytes [0]; } if (bytes.length == 2) {// 中文字符 int hightByte = 256 + bytes [0]; int lowbyte = 256 + bytes [1]; return (256 * hightbyte + lowbyte) - 256 * 256; // 返回 ascii} return 0; // 错误} /** * 根据 ascii 码到 Spellmap 中查找对应的拼音 * @param ascii ascii * @return ascii 对应的拼音, 如果 ascii 对应的字符为单字符 , 则返回对应的单字符, 如果不是单字符且在 Spellmap 中没找到对应的拼音 , 则返回空字符串 (""), */ public static String getSpellByascii (int ascii) {if (ascii> 0 && ascii <160) {// 单字符 return String. valueof ((char) ascii); } if (ascii <-20319 || ascii> -10247) {// 不知道的字符 return ""; } String bell = null; // Key Ganzzahl Asciirang; // Value String bellPrevious = null; // 用来保存上次轮循环的 Key int asciirangPrevious = -20319; // 用来保存上一次循环的 Wert für (iterator it = Spellmap.keyset (). Iterator (); it.hasnext ();) {Spell = (String) it.next (); // 拼音 asciirang = Spellmap.get (Zauber); // 拼音的 ascii if (asciirang! Zauber: Zaubersprüche; } else {SpellPrevious = Spell; AsciirangPrevious = Asciirang; } } } zurückkehren ""; } /** * 获取字符串的全拼或首拼, 是汉字则转化为对应的拼音或拼音首字母, 其它字符不进行转换 * @param cnstr 要获取全拼或首拼的字符串 * @param Nurfirstspell 是否只获取首拼 , 为 true 时 , 只获取首拼 , 为 false 时 获取全拼 获取全拼 * @return String cnstr 的全拼或首拼, 如果 cnstr 为 null 时, 返回 "" */ public static String getSpell (String cnstr, boolean nurFirstspell) {if (cnstr == null) {return ""; } char [] chars = cnstr.trim (). toarArray (); StringBuffer sb = new StringBuffer (); für (int i = 0, len = chars.length; i <len; i ++) {int ascii = getCnascii (chars [i]); if (ascii == 0) {// 如果获取汉字的 ascii 出错 , 则不进行转换 sb.append (chars [i]); } else {String bell = getSpellByascii (ASCII); // 根据 ascii 取拼音 if (Spell == null || Spell.length () == 0) {// 如果根据 ascii 取拼音没取到 , 则到生僻字 map 中取 bell = uncommonwordsmap.get (chars [chars [ ich]); } if (Spell == NULL || Spell.length () == 0) {// 如果没有取到对应的拼音 , 则不做转换 , 追加原字符 Spell = uncommonwordsmap.get (chars [i]); } else {if (nurfirstspell) {sb.append (Spell.StartSwith ("'")? Spell.Substring (1, 2): Spell.Substring (0, 1)); } else {sb.Append (Zauber); }}}} // Ende von für return sb.toString (); } public static void main (String [] args) {String [] S = {"获取汉字全拼和首拼测试", "Dies ist ein Test", "a, b; c [d]", "标 ,点。 "," 圆角数字123 , 特殊符号・¥% - ... "," 繁体字 : 西安 "," 西安 "," 山 "}; für (int i = 0; i <sength; i ++) {long l1 = system.currentTimemillis (); System.out.println (s [i] + "的全拼:" + getSpell (s [i], false)); System.out.println (s [i] + "的首拼:" + getSpell (s [i], true)); System.out.println ("获取全拼和首拼 共 用了"+(System.currentTimemillis ()-L1)+"毫秒/n"); }}}