Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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


Ïà¹ØÎĵµ£º

JAVA»ù´¡ÖªÊ¶¾«»ª×ܽá

 1¡¢ ¶ÔÏóµÄ³õʼ»¯
(1) ·Ç¾²Ì¬¶ÔÏóµÄ³õʼ»¯ 
ÔÚ´´½¨¶ÔÏóʱ£¬¶ÔÏóËùÔÚÀàµÄËùÓÐÊý¾Ý³ÉÔ±»áÊ×ÏȽøÐгõʼ»¯¡£ 
»ù±¾ÀàÐÍ£ºintÐÍ£¬³õʼ»¯Îª0¡£ 
Èç¹ûΪ¶ÔÏó£ºÕâЩ¶ÔÏó»á°´Ë³Ðò³õʼ»¯¡£ 
¡ùÔÚËùÓÐÀà³ÉÔ±³õʼ»¯Íê³ÉÖ®ºó£¬²Åµ÷Óñ¾ÀàµÄ¹¹Ôì·½·¨´´½¨¶ÔÏó¡£ 
¹¹Ôì·½·¨µÄ×÷ÓþÍÊdzõʼ»¯ ......

Éî¿ÌÀí½âJava±à³ÌµÄ7¸öÀý×Ó

 1. ÔĶÁÏÂÁдúÂë»Ø´ðÎÊÌ⣨µÚÒ»¸öJava³ÌÐò£¬Àí½âPATHºÍCLASSPATH£¬Ñ§»áʹÓÃjavacºÍjavaÃüÁ
view plaincopy to clipboardprint?
package cn.edu.uibe;  
public class HelloWorld {  
    public static void main(String[] args) {  
   &nb ......

JavaÖеÄinstanceof¹Ø¼ü×Ö

instanceofÊÇJavaµÄÒ»¸ö¶þÔª²Ù×÷·û£¬ºÍ==£¬>£¬<ÊÇͬһÀණ¶«¡£ÓÉÓÚËüÊÇÓÉ×Öĸ×é³ÉµÄ£¬ËùÒÔÒ²ÊÇJavaµÄ±£Áô¹Ø¼ü×Ö¡£ËüµÄ×÷ÓÃÊDzâÊÔËü×ó±ßµÄ¶ÔÏóÊÇ·ñÊÇËüÓұߵÄÀàµÄʵÀý£¬·µ»ØbooleanÀàÐ͵ÄÊý¾Ý¡£¾Ù¸öÀý×Ó£º
¡¡¡¡String s = "I AM an Object!";
¡¡¡¡boolean isObject = s instanceof Object;
¡¡¡¡ÎÒÃÇÉùÃ÷ÁËÒ»¸öSt ......

JavaÊÖ»ú¿ª·¢Æ½Ì¨ J2ME


J2ME£¬ÏÖ³ÆΪJava ME(Java Platform, Micro Edition )ÊÇΪ»ú¶¥ºÐ¡¢Òƶ¯µç»°ºÍPDAÖ®ÀàǶÈëʽÏû·Ñµç×ÓÉ豸ÌṩµÄJavaÓïÑÔƽ̨£¬°üÀ¨ÐéÄâ»úºÍһϵÁбê×¼»¯µÄJava API¡£ËüºÍJava SE¡¢Java EEÒ»Æð¹¹³ÉJava¼¼ÊõµÄÈý´ó°æ±¾£¬²¢ÇÒͬÑùÊÇͨ¹ýJCP£¨Java Community Process£©Öƶ©µÄ¡£
Ä¿Ç°½×¶Î£¬Java ME×îÁ÷ÐеÄÓ¦ÓÃÊÇÓÎÏ·Èí¼þ¡£ÒòÎ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ