I'm testing an AJAX application, and I need to test my loading/wait screens. I'd like to make the application take a longer time to respond to an AJAX request. The following code works okay, but is rather inelegant. Perhaps a thread or a timer?
int i = 0
double j
for (i = 0; i < 1000000; i++) {
j = Math.sin(j);
}