qileilove

          blog已經轉移至github,大家請訪問 http://qaseven.github.io/

          Java System類的使用

          import java.util.*;
          public class SystemTest
          {
          public static void main(String[] args)
          {
          //測試arraycopy方法,注意,目的空間必須提前分配
          int[] src = {1,2,3,4,5,6,7,8,9};
          System.out.println("System.arraycopy");
          int[] dst = new int[src.length];
          System.arraycopy(src, 0, dst, 0, src.length);
          System.out.println("src = "+Arrays.toString(src));
          System.out.println("dst = "+Arrays.toString(dst));
          //同樣是拷貝,Arrays.copyOf方法就不需要手動開辟空間
          System.out.println("Arrays.copyOf");
          int[] dst1 = Arrays.copyOf(src, src.length);
          System.out.println("src = "+Arrays.toString(src));
          System.out.println("dst1 = "+Arrays.toString(dst1));
          //測試currentTimeMillis()
          System.out.println("currentTimeMillis "+System.currentTimeMillis());
          //測試nanoTime(),單獨輸出的結果沒有仍和意義,此函數只能用來計算時間差
          System.out.println("nanoTime "+System.nanoTime());
          long dt=System.nanoTime();
          dt = dt - System.nanoTime();
          System.out.println("dt = "+dt);
          //測試getenv(),注意遍歷Map的用法,不是很理解
          System.out.println("System.getenv");
          Map<String,String> env = System.getenv();
          Iterator it = env.entrySet().iterator();
          while(it.hasNext())
          {
          Map.Entry a = (Map.Entry)it.next();
          System.out.println("<"+a.getKey()+"> = <"+a.getValue()+">;");
          }
          //getProperties(),注意遍歷Map的用法,不是很理解
          System.out.println("System.getProperties");
          Properties p = System.getProperties();
          p.list(System.out);
          System.out.println("Hello World!");
          }
          }

          posted on 2014-04-11 10:32 順其自然EVO 閱讀(196) 評論(0)  編輯  收藏 所屬分類: 測試學習專欄

          <2014年4月>
          303112345
          6789101112
          13141516171819
          20212223242526
          27282930123
          45678910

          導航

          統計

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 正宁县| 晴隆县| 南投市| 吉林省| 安泽县| 南昌县| 瓮安县| 恩平市| 鄂尔多斯市| 疏附县| 康乐县| 拉萨市| 云林县| 清河县| 徐汇区| 衡水市| 新疆| 资溪县| 绍兴县| 商都县| 平泉县| 顺义区| 刚察县| 枝江市| 高青县| 宁陕县| 资中县| 文成县| 遵义市| 双江| 五莲县| 清水县| 伊金霍洛旗| 平武县| 东乡| 本溪市| 民勤县| 澎湖县| 克拉玛依市| 会昌县| 安吉县|