944,167 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 14835
  • Java RSS
May 23rd, 2007
0

How to get total time of running program

Expand Post »
Hai,
I write a simulation and need to set the time for running the simulation. the simulation should stop based on the time that heve been set .How to set start time, get the current time and lastly to get the total time of java running program? really hope u can help me asap
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
eena75 is offline Offline
1 posts
since May 2007
May 23rd, 2007
0

Re: How to get total time of running program

So what have u tried so far.. ?
Post the code you've done..
Reputation Points: 254
Solved Threads: 74
Practically a Posting Shark
thekashyap is offline Offline
804 posts
since Feb 2007
May 23rd, 2007
0

Re: How to get total time of running program

1) we don't do your homework for you, show some effort
2) we're certainly not going to let you order us around to do it "asap". If and when we do anything it'll be at a time and place of our choosing, not yours, suggesting anything else makes us LESS eager to help you.
3) (general warning) it's NOT "urgent" to anyone except possibly you, and if it is you should have started sooner.
4) properly define your problem domain. WHAT do you want to measure exactly? What that is defines where and how to measure it.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Jan 11th, 2008
0

Re: How to get total time of running program

can someone teach me how to get the running time of this program?
Java Syntax (Toggle Plain Text)
  1. import java.io.*;
  2. public class ArrauSample {
  3.  
  4. public static void main(String args[]){
  5.  
  6. BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
  7. int x=0;
  8. int max= 5;
  9.  
  10. int myNum[] = new int[max];
  11. String myString[] = new String[max];
  12.  
  13. try{
  14. for(x=0; x<max; x++)
  15. {
  16. System.out.println("Input element #" + (x+1));
  17. myString[x]=console.readLine();
  18. }
  19. }catch(IOException e){}
  20.  
  21. for(x=0; x<max; x++)
  22. {
  23. System.out.print("Element #" + (x+1));
  24. System.out.println(myString[x]);
  25. }
  26.  
  27.  
  28. }
  29.  
  30.  
  31. }
thank you very much!
Reputation Points: 10
Solved Threads: 0
Light Poster
babyfrostie is offline Offline
39 posts
since Oct 2007
Jan 11th, 2008
0

Re: How to get total time of running program

Well the basic way of getting time in a program is to use

long x = System.getCurrentTime();

which returns the current time of the computer in milliseconds.

Anyone with a brain could figure it out from there! :p
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
mickinator is offline Offline
55 posts
since Oct 2007
Jan 11th, 2008
0

Re: How to get total time of running program

ammm we should compute it with our hands lol..
Reputation Points: 10
Solved Threads: 0
Light Poster
babyfrostie is offline Offline
39 posts
since Oct 2007
Jan 12th, 2008
0

Re: How to get total time of running program

ive an abacus if you want one
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
mickinator is offline Offline
55 posts
since Oct 2007
Jan 12th, 2008
0

Re: How to get total time of running program

Click to Expand / Collapse  Quote originally posted by mickinator ...
Well the basic way of getting time in a program is to use

long x = System.getCurrentTime();

which returns the current time of the computer in milliseconds.

Anyone with a brain could figure it out from there! :p
there is no such method in my Java API

perhaps you are thinking of System.currentTimeMillis()
Reputation Points: 53
Solved Threads: 33
Posting Whiz in Training
bugmenot is offline Offline
224 posts
since Nov 2006
Jan 12th, 2008
0

Re: How to get total time of running program

Lol, my mistake, thats it right there.
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
mickinator is offline Offline
55 posts
since Oct 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: query
Next Thread in Java Forum Timeline: j2me textfield password





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC