code: private DisplayMode isSupported(DisplayMode display)
      {
          final DisplayMode[] supported = dev.getDisplayModes();
          for (final DisplayMode current : supported)
          {
              final boolean multiDepth = current.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && display.equals(current);
              if (multiDepth
                  || current.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI
                     && display.getWidth() == current.getWidth()
                     && display.getHeight() == current.getHeight())
              {
                  return current;
              }
          }
          return null;
      }
docs: Check if the display mode is supported.
  
  @param display The display mode to check.
  @return Supported display, <code>null</code> else.