0

Hey I know there are other questions like this but I am puzzled as to how I can do this the way I want. I want to run my program that basically does something with the given input value then outputs the time it took to do this in ms to a Text File. I want to do this for value starting at 10,000 and incrementing by 10,000 until 200,000 and output the value to a TXT File. Like this

for (int i = 10000; i < 200000; i+=10000){
     print i
     java Program i > results.txt
}

So out put printed to the text file would be something like:

10000    30ms
20000    56ms
30000    75ms
etc      etc

Any help would be greatly appreciated, thanks in advance

dbenham
  • 127,446
  • 28
  • 251
  • 390
  • similiar to this: http://stackoverflow.com/questions/692569/how-can-i-count-the-time-it-takes-a-function-to-complete-in-java – oentoro Apr 07 '13 at 03:42
  • To a txt file though @cakil – user2247526 Apr 07 '13 at 03:44
  • maybe you can learn from here: http://stackoverflow.com/questions/5865453/java-writing-to-a-text-file – oentoro Apr 07 '13 at 03:46
  • @cakil that's not quite what im after sorry. I want to execute a batch file with a loop like the above, that runs the java program, but im unsure how to implement. Thank you though – user2247526 Apr 07 '13 at 03:53

1 Answers1

0

I think, you mean this:

@echo off
(for /l %%i in (10000,10000,200000) do "my Java program" %%i)>"results.txt"
Endoro
  • 37,015
  • 8
  • 50
  • 63