void bubbleSort() {
for(int i=num-2;i>=0;i--) {
for(int j=0;j<=i;j++) {
if(ar[j]>ar[j+1]) {
int t=ar[j];
ar[j]=ar[j+1];
ar[j+1]=t;
}
try {
Thread.sleep(SLEEP_SORT_MS);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
draw();
}
}
}
}
I was making a program to visualize bubble sort using javafx, and Thread.sleep() did not work properly. Is it possible to make JavaFx wait for a time?