public MultiBufferTest(int numBuffers, GraphicsDevice device) {
		try {
			GraphicsConfiguration gc = device.getDefaultConfiguration();
			mainFrame = new Frame(gc);
			mainFrame.setUndecorated(true);
			mainFrame.setIgnoreRepaint(true);
			device.setFullScreenWindow(mainFrame);
			if (device.isDisplayChangeSupported()) {
				chooseBestDisplayMode(device);
			}
			Rectangle bounds = mainFrame.getBounds();
			mainFrame.createBufferStrategy(numBuffers);
			BufferStrategy bufferStrategy = mainFrame.getBufferStrategy();
			for (float lag = 2000.0f; lag > 0.00000006f; lag = lag / 1.33f) {
				for (int i = 0; i < numBuffers; i++) {
					Graphics g = bufferStrategy.getDrawGraphics();
					if (!bufferStrategy.contentsLost()) {
						g.setColor(COLORS[i]);
						g.fillRect(0,0,bounds.width, bounds.height);
						bufferStrategy.show();
						g.dispose();
					}
					try {
						Thread.sleep((int)lag);
					} catch (InterruptedException e) {}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			device.setFullScreenWindow(null);
		}
	}