public void sanityCheck() {

		if (DEBUG) {

			System.out.print(this);
			int[] widthsCheck = new int[height];
			int maxHeightCheck =0;
			for(int i =0; i< width;i++){
				int heightCheck = 0;
				for(int j =0; j< height;j++){
					if(grid[i][j])
					{
						heightCheck = j+1;
						widthsCheck[j]++;

						if(maxHeightCheck<j+1)
							maxHeightCheck = j+1;
					}
				}
				if(heightCheck!=heights[i])
					throw new RuntimeException("Heights check failed");
			}
			if(!Arrays.equals(widthsCheck, widths))
				throw new RuntimeException("Widths check failed");

			if(maxHeightCheck != maxHeight)
				throw new RuntimeException("Max Height check failed");

		}
	}