I am currently writing a Java application that requires quite a lot of calls to the Twitter API. Because of this I have to worry about exceeding the rate limit. I figured out that I can make 180 calls per 14 minutes and then I have to wait a period of time before I can start calls to the API again (this number is returned in the application). So, when calls reach a certain number I have my thread sleep. My intention is to have the thread pick up where it left off automatically when sleep() is over. Does this work or do I have to worry about CPU scheduling and things like that!?

Maybe I don't fully understand how sleep is supposed to work. Any help would be greatly appreciated is seeing whether or not what I am doing is right. Thank you!

Below is just a couple of lines of pseudo code:

```
for (int i = 0; i < arr.length; i++) 
{
    if (calls are a certain number) 
    {
        Thread.sleep(840*1000);
        continue;
    }
      //CALL TO METHOD THAT REQUESTS INFORMATION FROM TWITTER API
}

```