In this paper, a new method for constructing zero cross-correlation codes (ZCC) is investigated. The design of code parameters is an important factor which enhances the performance of OCDMA system. An efficient code design provides a minimum cross-correlation, a maximum number of users with minimum code length, effective weights and flexibility of implementation. The newly proposed method offers a good flexibility in the choice between the number of users, the weight and the code length without any constraint by using transformation and mapping technique respectively. The performance comparison shows that the code length of the proposed ZCC code is quite small compared to other existing codes with the best cross-correlation which is equal to zero. Thus, the Multiple Access Interface (MAI) can be significantly reduced and the performance of the OCDMA system subsequently improved.