A numerical algorithm to solve the spectral problem for arbitrary self-adjoint extensions of 1D regular Schroedinger operators is presented. It is shown that the set of all self-adjoint extensions of 1D regular Schroedinger operators is in one-to-one correspondence with the group of unitary operators on the finite dimensional Hilbert space of boundary data, and they are characterized by a generalized class of boundary conditions that include the well-known Dirichlet, Neumann, Robin, (quasi-)periodic boundary conditions, etc. The numerical algorithm is based on a nonlocal boundary extension of the finite element method and their convergence is proved. An appropriate basis of boundary functions must be introduced to deal with arbitrary boundary conditions and the conditioning of its computation is analyzed. Some significant numerical experiments are also discussed as well as the comparison with some standard algorithms. In particular it is shown that appropriate perturbations of standard boundary conditions for the free particle leads to the theoretically predicted result of very large absolute values of the negative groundlevels of the system as well as the localization of the corresponding eigenvectors at the boundary (edge states).