public static int extractGid(int[] data, int x, int y, int width, int height) {
		if (x < 0 || width <= x || y < 0 || height <= y) {
			throw new IllegalArgumentException("(x, y) lies outside the " +
					"range denoted by width and height");
		}
		long t = access(data, x, y, width, height);
		t = maskFlipBits(t);
		return (int)t;
	}