public static int[][] transpose(int[][] matrix){
		//preconditions
		if(matrix == null)throw new IllegalArgumentException("matrix must not be null");
		for(int i = 0; i < matrix.length; i++){
			if(matrix.length != matrix[i].length)throw new IllegalArgumentException("matrix must be square!");
		}
		
		int[][] newMatrix = new int[matrix.length][matrix.length];
		for(int i = 0; i < matrix.length; i++){
			for(int j = 0; j < matrix.length; j++){
				newMatrix[j][i] = matrix[i][j];
			}
		}
		
		return newMatrix;
	}