long frames, fps, fpsTimer;
public final void calculateFps() {
frames++;
if(System.currentTimeMillis() - fpsTimer < 1000L) return;
fpsTimer = System.currentTimeMillis();
fps = frames;
frames = 0L;
}
double fps = 1000000.0 / (lastTime - (lastTime = System.nanoTime())); //This way, lastTime is assigned and used at the same time.