long frames, fps, fpsTimer; public final void calculateFps() { frames++; if(System.currentTimeMillis() - fpsTimer < 1000L) return; fpsTimer = System.currentTimeMillis(); fps = frames; frames = 0L; }