Skip to content

Instantly share code, notes, and snippets.

@mizushou
Created October 9, 2017 18:53
Show Gist options
  • Save mizushou/25d1cae145f5e2a61e28f1c7c3980e44 to your computer and use it in GitHub Desktop.
Save mizushou/25d1cae145f5e2a61e28f1c7c3980e44 to your computer and use it in GitHub Desktop.
class TimeMeasurement {
public static void main(String[] args) {
long start = System.nanoTime();
// some processing
int[] a = {1,2,3,4,4,5,6,7,8,9,10};
for(int i=0; i<a.length; i++){
System.out.println(a[i]);
};
long end = System.nanoTime();
System.out.println("Time : " + (end - start) / 1000000f + "ms");
}
}
@mizushou
Copy link
Author

mizushou commented Oct 9, 2017

処理時間計測

  • ナノ秒で計測
  • 結果はミリ秒に変換して出力

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment