  The locally repairable code (LRC) studied in this paper is an $[n,k]$ linear
code of which the value at each coordinate can be recovered by a linear
combination of at most $r$ other coordinates. The central problem in this work
is to determine the largest possible minimum distance for LRCs. First, an
integer programming based upper bound is derived for any LRC. Then by solving
the programming problem under certain conditions, an explicit upper bound is
obtained for LRCs with parameters $n_1>n_2$, where $n_1 = \left\lceil
\frac{n}{r+1} \right\rceil$ and $n_2 = n_1 (r+1) - n$. Finally, an explicit
construction for LRCs attaining this upper bound is presented over the finite
field $\mathbb{F}_{2^m}$, where $m\geq n_1r$. Based on these results, the
largest possible minimum distance for all LRCs with $r \le \sqrt{n}-1$ has been
definitely determined, which is of great significance in practical use.
