To find the FPS, you count the number of frames that occur in 1 second by having a frame counter and a time keeper:
int frames = 0;
long lastTime = System.nanoTime();
while(true) {
//game loop
frames++;
if(System.nanoTime() - lastTime >= 1e9) { //1e9 = 1 * 10 ^ 9 = 1,000,000,000 nanoseconds = 1 second :)
System.out.println(frames);
frames = 0;
lastTime += 1e9;
}
}