posts - 41,  comments - 40,  trackbacks - 0

          我原來(lái)把數(shù)字變成字符串,使用""+1000,但是經(jīng)過(guò)測(cè)試,發(fā)現(xiàn),,,呵呵,你自己測(cè)試吧:

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

          ??? 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 閱讀(2087) 評(píng)論(8)  編輯  收藏 所屬分類(lèi): Java
          主站蜘蛛池模板: 和田市| 临朐县| 綦江县| 武宣县| 辉县市| 永胜县| 青铜峡市| 朝阳区| 呼和浩特市| 象州县| 武城县| 通山县| 长岭县| 三门县| 怀柔区| 金堂县| 永泰县| 朝阳市| 科技| 恩施市| 兴城市| 东兴市| 德清县| 玉林市| 昌黎县| 兴海县| 嘉兴市| 渭南市| 确山县| 班戈县| 紫云| 新余市| 重庆市| 渭南市| 东乡族自治县| 临西县| 富民县| 临湘市| 涞源县| 临泽县| 阆中市|