title: loop to calculate timestamps
body: <p>I have a String input for timestamp like this:</p>
  
  <pre><code>23 46 22
  </code></pre>
  
  <p>where '23' denoted Hour of the day, '46' is the minute and '22' is the second.</p>
  
  <p>I have a trivial problem. I need to get all the timestamps from this instance till the end of the day, i.e. from <code>23 46 22</code> to <code>23 59 59</code></p>
  
  <p>The loop that I am using to get all the timestamps (one at a time) is:</p>
  
  <pre><code>for (int i = hour; i &lt; 24; i++) {
      for (int j = minute; j &lt; 60; j++) {
          for (int k = second; k &lt; 60; k++) {
  
          }
      } 
  }
  </code></pre>
  
  <p>But this loop has a problem. The second counter will always start from the current second only, e.g.:</p>
  
  <pre><code>23 46 22
  23 46 23.....
  ..
  23 47 22
  23 47 23...
  </code></pre>
  
  <p>I want to get timestamps in correct manner, e.g.:</p>
  
  <pre><code>23 46 22
  23 46 23.....
  ..
  23 47 01
  23 47 02...
  </code></pre>
  
  <p>What is the elegant way to do this?</p>