public static boolean[][] trim( boolean[][] m ){
		int minx = m.length;
		int miny = m[0].length;
		int maxx = 0;
		int maxy = 0;

		for (int x = 0; x < m.length; x++) {
			for (int y = 0; y < m[0].length; y++) {
				if( !m[x][y] ){
					continue;
				}
				if( x < minx ) minx = x;
				if( y < miny ) miny = y;
				if( x > maxx ) maxx = x;
				if( y > maxy ) maxy = y;
			}
		}
		
		boolean[][] ret = init( maxx-minx+1, maxy-miny+1 );
		for (int x = 0; x < ret.length; x++) {
			for (int y = 0; y < ret[0].length; y++) {
				ret[x][y] = m[minx+x][miny+y];
			}
		}
		return ret;
	}