Due to the rapid increase in wireless applications and the number of users, spectrum scarcity, energy consumption and latency issues will emerge, notably in the fifth generation (5G) system. Cognitive radio (CR) has emerged as the primary technology to address these challenges, allowing opportunist spectrum access as well as the ability to analyze, observe, and learn how to respond to environmental 5G conditions. The CR has the ability to sense the spectrum and detect empty bands in order to use underutilized frequency bands without causing unwanted interference with legacy networks. In this paper, we presented a spectrum sensing algorithm based on energy detection that allows secondary user SU to transmit asynchronously with primary user PU without causing harmful interference. This algorithm reduced the sensing time required to scan the whole frequency band by dividing it into n sub-bands that are all scanned at the same time. Also, this algorithm allows cognitive radio networks (CRN) nodes to select their operating band without requiring cooperation with licensed users. According to the BER, secondary users have better performance compared with primary users.