private static String getBestFrequency(String resolution, DisplayMode[] modes) {
        int closest = Integer.MAX_VALUE;
        int desired = 60;
        for (DisplayMode mode : modes) {
            String res = mode.getWidth() + " x " + mode.getHeight();
            int freq = mode.getRefreshRate();
            if (freq != DisplayMode.REFRESH_RATE_UNKNOWN && res.equals(resolution)) {
                if (Math.abs(freq - desired) < Math.abs(closest - desired)) {
                    closest = mode.getRefreshRate();
                }
            }
        }

        if (closest != Integer.MAX_VALUE) {
            return closest + " Hz";
        } else {
            return null;
        }
    }
Chooses the closest frequency to 60 Hz.

@param resolution
@param modes
@return
jme3-awt-dialogs/src/main/java/com/jme3/awt/AWTSettingsDialog.java