well you could use a while loop until the number is between 20.
boolean done = false;
while(!done)
{
int sec = cal.get(Calendar.SECOND);
int sec2 = sec / 3;
int sec3 = Math.round(sec2);
if(sec3 >= 1 && sec3 <= 20)
done = true;
}
Now, it does the process until the final number is between 1 and 20.
Does this help?