private DisplayMode getBestDisplayMode() {
      
      ArrayList modes = new ArrayList();
      modes.addAll(Arrays.asList(fullScreenDevice.getDisplayModes()));
      Collections.sort(modes, new DisplayModeComparator());
      
      DisplayMode bestMode = null;
      int i = 0;
      
      while(bestMode == null) {
         i++;
         DisplayMode mode = (DisplayMode)modes.get(i);
         
         //check size
         int w = fullScreenComp.getWidth();
         int h = fullScreenComp.getHeight();
         
         if(w>mode.getWidth()) continue;
         if(h>mode.getHeight()) continue;
         
         //now check for other bit depths 
         bestMode = mode;
         
         for(int j=i;j<modes.size();j++) {
            mode = (DisplayMode)modes.get(j);
            if(mode.getWidth() == bestMode.getWidth() && mode.getHeight() == bestMode.getHeight()) {
               if(mode.getBitDepth() > bestMode.getBitDepth()) {
                  bestMode = mode;
               }
            }
            else {
               break;
            }
         }
      }
      
      return bestMode;
   }