Are you sure that the loops shown take the time? Time the loop's execution time by using calls to the System.currentTimeMillis() method.