  The paper is devoted to nonlinear localized modes ("gap solitons") for the
spatially one-dimensional Gross-Pitaevskii equation (1D GPE) with a periodic
potential and repulsive interparticle interactions. It has been recently shown
(G. L. Alfimov, A. I. Avramenko, Physica D, 254, 29 (2013)) that under certain
conditions all the stationary modes for the 1D GPE can be coded by bi-infinite
sequences of symbols of some finite alphabet (called "codes" of the solutions).
We present and justify a numerical method which allows to reconstruct the
profile of a localized mode by its code. As an example, the method is applied
to compute the profiles of gap solitons for 1D GPE with a cosine potential.
