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)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 苍溪县| 延吉市| 胶州市| 开封县| 碌曲县| 浑源县| 巴南区| 通许县| 喜德县| 黔东| 新干县| 铜山县| 大冶市| 信宜市| 鄢陵县| 罗山县| 福鼎市| 松原市| 琼中| 察哈| 孝感市| 宁国市| 齐齐哈尔市| 股票| 阜宁县| 贡嘎县| 溧阳市| 凤翔县| 桑植县| 孟连| 淮南市| 普宁市| 白山市| 新乡市| 博野县| 乌审旗| 谢通门县| 宝清县| 松阳县| 桐柏县| 大足县|