public static byte[] assemble(byte[][] matrix, int rows) {
    	int len = 0;
    	for(int i = 0; i < rows; i++) 
    		len += matrix[i].length;
    	byte[] assembled = new byte[len];
    	int off = 0;
    	for(int i = 0; i < rows; i++) {
    		System.arraycopy(matrix[i], 0, assembled, off, matrix[i].length);
    		off += matrix[i].length;
    	}
    	return assembled;
    }