Computer experiments can build computationally cheap statistical models to study complex computer models. These experiments are commonly conducted using maximin distance Latin hypercube designs (LHDs), generated using heuristic algorithms or algebraic methods in the literature. However, the performance of these algorithms deteriorates as the number of factors increases, and the algebraic methods work only for numbers of runs that are of a special kind, say, a prime number. To overcome these limitations, we introduce an integer programming algorithm to construct maximin distance LHDs of flexible sizes. Our algorithm leverages recent advances in the field of optimization, as implemented in commercial optimization solvers. Moreover, it benefits from the attractive algebraic structures given by good lattice point sets and the Williams transformation. Using comprehensive numerical experiments, we show that, with a few exceptions, our proposed algorithm outperforms benchmark algorithms and methods for constructing LHDs with up to 113 runs.