title: How to execute task for a specific period in Java.?
body: <p>In fact I would execute a specific task( a set of instructions) for a determined period.</p>
  
  <p>For example : I want my program to execute the task for 5 minutes, if it gets the right result  it stops , else it will continue executing normal task for the 5 minutes and in the end it tells me.</p>
  
  <p>How can I implement this in Java.</p>