title: Android and time
body: <p>I have loop for:</p>
  
  <pre><code>for (int i = 1; i &lt; 2000; i++)
  </code></pre>
  
  <p>How I can change this  loop that instead of int &lt; 2000 I can get time:</p>
  
  <pre><code>for (int i = 1; i &lt; 2000(miliseconds); i++)
  </code></pre>
  
  <p>I want to do this loop until time is less then 2000 miliseconds.I mean that this loop must working for 2 seconds and after 2 sec break. </p>
  
  <p>In loop I doing some operations. I save position of cursor. I want save that position for 2 seconds.</p>