nit: you should probably do the "System.currentTimeMillis() - startTime" computation once before the IF, store it and print it here, so the times are not different.