Calculation of localization length in disordered chains