public List<int[]> buildPolynomialCode() {
		// Creates list of code words.
		List<int[]> code = new ArrayList<int[]>();
		// Adds 0 (zero) as the first valid code word.
		code.add(new int[n]);
		// Calls the generator polynomial g(x) or just g.
		int[] g = generatorPolynomial;
		// Gets the number of elements in galois field.
		int gf = galoisField.getElements();
		// Let m be the degree of generator polynomial g(x). Since every code word w(x) of
		// polynomial code is divisible by g(x), the degree of w(x) has to be greater than
		// or (at least) equals m=deg(g). Hence, only code words with those properties are 
		// going to be evaluated and added to code word list in the following.
		int[] word = new int[n];
		if ( n == 1 ) {
			// TODO: if ( m == 1 ) or ( m == 0 )
		}
		// For the case m=n, it has to be m=n=1. For instance, g(x)=x and the only valid
		// code word is 0. Otherwise (i.e. for other values of n>1), it holds m < n.
		// Therefore, only the case m < n is considered and the code words of length n are
		// retrieved in the following.
		for ( int j = n-1; j >= 0; j-- ) {
			try {
				word[j] = ( g[j] != 0 ) ? g[j] : 0;
			} catch ( ArrayIndexOutOfBoundsException ae ) {
				word[j] = 0;
				continue;
			}
		}
		 // This generator polynomial g(x) is a valid code word, because it is divisible by itself.
		int[] gWord = new int[n];
		System.arraycopy(generatorPolynomial, 0, gWord, 0, generatorPolynomial.length);
		code.add(gWord);
		// Next, retrieves the code words that are bigger than and divisible by g(x).
		while ( !isBiggest(word) ) {
			word[0] = (word[0] + 1) % gf;
			int k = 0;
			while ( word[k] == 0 ) {
				word[k+1] = (word[k+1] + 1) % gf;
				k++;
			}
			// Creates new array to store content of code word.
			int[] validWord = new int[n];
			System.arraycopy(word, 0, validWord, 0, n);
			// Checks if this code word is valid, i.e. divisible by g(x).
			if ( validate(word) ) {
				// Adds this code word if it is valid (divisible by g(x)).
				code.add(validWord);
			}
		}
		return code;
	}