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

4
  • similiar to this: stackoverflow.com/questions/692569/… Commented Apr 7, 2013 at 3:42
  • To a txt file though @cakil Commented Apr 7, 2013 at 3:44
  • maybe you can learn from here: stackoverflow.com/questions/5865453/java-writing-to-a-text-file Commented Apr 7, 2013 at 3: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 Commented Apr 7, 2013 at 3:53

1 Answer 1

0

I think, you mean this:

@echo off
(for /l %%i in (10000,10000,200000) do "my Java program" %%i)>"results.txt"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.