We propose a new high-precision algorithm for solving the initial problem for the Zakharov-Shabat system. This method has the fourth order of accuracy and is a generalization of the second order Boffetta-Osborne scheme. It is allowed by our method to solve more effectively the Zakharov-Shabat spectral problem for continuous and discrete spectra. Keywords Zakharov-Shabat problem, inverse scattering transform, nonlinear Schrödinger equation, numerical methods The solution of the direct problem for the Zakharov-Shabat problem (ZSP) is the first step in the inverse scattering transform (IST) for solving the nonlinear Schrödinger equation (NLSE) [1]. The numerical implementation of the IST has gained great importance and attracted special attention since Hasegawa and Tappert [2] proposed to use soliton solutions as a bit of information for fiber optic data transmission.