Bunch lengthening phenomenon is resulted from one of the most severe single bunch instabilities in storage rings. We develop a new code to calculate the single bunch length and energy spread in storage rings using FORTRAN. In this code, wake field is calculated using an analytical formula, which is different from the previous ones. The bunch length and energy spread under different bunch currents are calculated for BEPCII by using this code, and the tracking results are in good agreement with those from other codes. The calculated energy spread clearly shows that the longitudinal microwave instability threshold is around 65mA for BEPCII storage ring.