Skip to content

Instantly share code, notes, and snippets.

@polyglotpiglet
Last active June 26, 2016 12:13
Show Gist options
  • Save polyglotpiglet/12aad23902e9a24aeb93ddda0ac62967 to your computer and use it in GitHub Desktop.
Save polyglotpiglet/12aad23902e9a24aeb93ddda0ac62967 to your computer and use it in GitHub Desktop.
public static void main(String... args) throws IOException {
Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File("/Users/alexbate/out.txt"))));
int count = 0;
for (int i =0; i <2000; i++) {
long startTime = System.nanoTime();
for (int j = 0; j < 1000; j ++) {
count += j;
}
long endTime = System.nanoTime();
writer.write("" + (endTime - startTime) + "\n");
System.out.println(i);
}
writer.close();
System.out.println(count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment