posts - 41,  comments - 40,  trackbacks - 0

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

          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 閱讀(2086) 評論(8)  編輯  收藏 所屬分類: Java
          主站蜘蛛池模板: 夏邑县| 许昌县| 卢氏县| 延庆县| 辽源市| 河曲县| 大田县| 朝阳市| 辽宁省| 高尔夫| 德阳市| 亳州市| 嫩江县| 古浪县| 高唐县| 运城市| 电白县| 昌平区| 永春县| 安岳县| 铁岭县| 新密市| 子长县| 七台河市| 北海市| 武宁县| 屏边| 乡宁县| 醴陵市| 内江市| 丘北县| 九龙城区| 嘉善县| 蒲江县| 裕民县| 南投县| 德令哈市| 察雅县| 广东省| 济南市| 额济纳旗|