Is there a method for constructing Binary (n, M, d) - codes. For e.g. the code (7, 2, 7) is just the Rep code (0000000, 1111111). But this was just by looking at it.What is the method for e.g.'s such as (8, 4, 5) or (7, 3, 5)? Don't want an answer just don't want to have to do trial and error approach because time is tight in exams. There must be a method to check. Any help greatly appreciated.

PS

n - lengths of codewords

M - number of codewords

d - minimum distance