LoginSignup
62

More than 5 years have passed since last update.

処理時間の計測

Last updated at Posted at 2014-06-22

javaで処理時間を計測するにはSystemクラスのcurrentTimeMillisメソッドを使うのが一番簡単みたい?currentTimeMillisは現在の時間を所得するメソッドなので、計測したい処理の前後の時間を計測して、引き算で処理時間が求まるっていう感じですかね・・

time.java
long start = System.currentTimeMillis();

//計測したい処理を記述

long end = System.currentTimeMillis();
System.out.println((end - start)  + "ms");

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
62