Use System.nanoTime() instead of System.currentTimeMillis() almost everywhere.  System.currentTimeMillis() can go backwards!