posts - 41,  comments - 40,  trackbacks - 0

          我原來把數字變成字符串,使用""+1000,但是經過測試,發(fā)現,,,呵呵,你自己測試吧:

          public final class WhoFaster2
          {
          ? public static void main( String[] args )
          ? {
          ??? long times=1000000L;? //百萬

          ??? long start=0L;

          ??? String temp=null;

          ??? /*/
          ??? start=System.currentTimeMillis();

          ??? temp=null;

          ??? for( int i=0; i<times; i++ )
          ?????? {
          ???????? temp=times+"";
          ?????? }

          ??? System.out.println( temp+" "+( System.currentTimeMillis()-start ) );
          ??? /*/
          ??? start=System.currentTimeMillis();

          ??? temp=null;

          ??? for( int i=0; i<times; i++ )
          ?????? {
          ???????? temp=Long.toString( times );
          ?????? }

          ??? System.out.println( temp+" "+( System.currentTimeMillis()-start ) );
          ??? //*/
          ? }
          }

          posted on 2007-09-17 01:23 NeedJava 閱讀(2092) 評論(8)  編輯  收藏 所屬分類: Java
          主站蜘蛛池模板: 读书| 龙陵县| 信阳市| 八宿县| 松阳县| 姚安县| 青冈县| 雷州市| 五峰| 九台市| 石首市| 衡阳市| 祁连县| 泽普县| 两当县| 子洲县| 宝兴县| 丘北县| 中牟县| 睢宁县| 普陀区| 出国| 江口县| 滨州市| 霍城县| 马尔康县| 绍兴县| 玉田县| 信宜市| 木兰县| 炉霍县| 杭锦旗| 昌邑市| 万州区| 靖宇县| 上蔡县| 白朗县| 昭通市| 西乡县| 桑日县| 娱乐|