java¿ªÔ´Àà¿âpinyin4jµÄʹÓÃ
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import net.sourceforge.pinyin4j.PinyinHelper;
public class PinyinComparator implements Comparator<Object> {
private String concatPinyinStringArray(String[] pinyinArray) {
StringBuffer pinyinStrBuf = new StringBuffer();
if ((null != pinyinArray) && (pinyinArray.length > 0)) {
for (int i = 0; i < pinyinArray.length; i++) {
pinyinStrBuf.append(pinyinArray[i]);
}
}
String outputString = pinyinStrBuf.toString();
return outputString;
}
public int compare(Object o1, Object o2) {
int length1 = ((String) o1).length();
int length2 = ((String) o2).length();
int length = length1 - length2 > 0 ? length2 : length1;
for (int i = 0; i < length; i++) {
char c1 = ((String) o1).charAt(i);
char c2 = ((String) o2).charAt(i);
String c1topinyin = concatPinyinStringArray(PinyinHelper.toHanyuPinyinStringArray(c1));
String c2topinyin = concatPinyinStringArray(PinyinHelper.toHanyuPinyinStringArray(c2));
&nbs
Ïà¹ØÎĵµ£º
×î½ü²Î¼ÓÁ˼¸´ÎÃæÊÔ£¬·¢ÏÖ¹«Ë¾µÄ±ÊÊÔÌâÄ¿ÓÐһЩÏàËÆÖ®´¦£¬¾Í×ܽáһϣº
Ò»°ã»á´ÓÏÂÃæ¼¸¸ö·½Ã濼£¬²»¹ÜÊÇÃæÊÔC++,C#,java¶¼ÊÇ
Ê×ÏÈÊǹØÓڹؼü×ֺͱêʾ³£Á¿µÄ¿¼²ì
È»ºóÊǹØÓÚÀàºÍ½Ó¿ÚµÄÊÔÌâ
È»ºóÊǹØÓÚarray,ioºÍsocketµÄÊÔÌâ
È»ºóÊǹØÓÚÊý¾Ý¿âµÄ¸÷ÖÖsqlÓï¾äµÄ¿¼²ì
È»ºóÊÇÅÅÐò£¬°üÀ¨¿ìËÙÅÅÐò£¬²åÈëÅÅÐò£ ......
ÏàÐÅ´ó¼ÒƽʱÅöµ½¹ýһЩÔÚJAVAÖжÔͼÏñ½øÐд¦ÀíµÄÐèÇ󣬱ÈÈçÐèÒª¶ÔÉÏ´«µÄͼƬ¼ÓÉÏ×Ô¼ºµÄÇ©Ãû»òͼ±ê£¬»òÕßÉú³ÉºÍ½âÎö¶¯Ì¬µÄGIFͼƬ£¬ÒÔ¼°´¦ÀíPSDÎļþͼÏñÐÅÏ¢¡£±¾ÎľÍJAVAÔÚͼÏñ´¦ÀíÖÐһЩ»ù±¾Ó¦ÓýøÐÐÁ˽éÉÜ¡£Ï£Íûͨ¹ýÄܹ»¶Ô´ó¼ÒÔÚÒÔºóµÄͼÏñ´¦ÀíÖÐÓÐЩ°ïÖú¡£
Ò»¡¢¶ÔÒ»¸öÏÖÓеÄͼƬ½øÐÐÎ ......
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundExce ......
Ä¿±ê£ºÊµÏÖÒ»¸öºº×Ö×Ö·û´®°´ººÓïÆ´Òô×Öµä˳ÐòÅÅÐò¡£
ÔÀí£ºÔÚwindows»·¾³µÄgbk×Ö·û¼¯Àºº×ÖÊǰ´ººÓïÆ´Òô×Öµä˳Ðò±àÂëµÄ£¬Èç“´¡”ÊÇB4A1£¬“´¢”ÊÇB4A2¡£ÕâÀïÓиöÎÊÌâ¾ÍÏñÉÏÃæµÄ´¢ºÍ´¡ÕâÑùµÄͬÒô×ÖÖ»ÄÜ×ñÕÕ±àÂëµÄ˳ÐòÁË£¬ÁíÍâ¶àÒô×ÖÒ²µÃ×ñÕÕ±àÂë˳Ðò¡£Éè¼ÆË¼Â·ÊÇÏȲð·Öºº×Ö×Ö·û´®Îª×Ö·ûÊý×飬»ñµÃÿ ......