ページの作成:「System<br>」
 
編集の要約なし
1行目: 1行目:
[[System]]<br>
[[System]]<br>
public static long currentTimeMillis()
ミリ秒で表される現在の時間を返します。戻り値の時間単位はミリ秒ですが、値の粒度は基本となるオペレーティング・システムによって異なり、単位がより大きくなる場合があります。たとえば、多くのオペレーティング・システムでは、時間を10ミリ秒の単位で計測します。
long start = System.currentTimeMillis();
        for (int i = 0; i < 10_000_000; i++) {
            System.out.println(i + ": Hello!");
        } 
long end = System.currentTimeMillis();
System.out.println("Time: " + (end - start) + "msecs");

2019年5月24日 (金) 12:46時点における版

System
public static long currentTimeMillis()

ミリ秒で表される現在の時間を返します。戻り値の時間単位はミリ秒ですが、値の粒度は基本となるオペレーティング・システムによって異なり、単位がより大きくなる場合があります。たとえば、多くのオペレーティング・システムでは、時間を10ミリ秒の単位で計測します。

long start = System.currentTimeMillis();
       for (int i = 0; i < 10_000_000; i++) {
           System.out.println(i + ": Hello!");
       }   
long end = System.currentTimeMillis();
System.out.println("Time: " + (end - start) + "msecs");