Objectives: This research work proposes a methodology for estimating the energy consumption of tasks by considering processor and memory usage. Methods: To facilitate energy efficiency in CPU, the mobile devices may be operated at different frequencies during the execution of tasks. This research work applies CPU frequency scaling as its base to achieve energy efficiency. Besides, it also considers energy consumption during memory access while making the offloading decision. Findings: The proposed approach uses energy consumption during computation as well as memory access as its metric to conceive the offloading decision. Additionally, the proposed energy model is simulated and the results are concluded that there is a considerable amount of energy saving in mobile devices due to computation offloading to nearby mobile devices or cloud resources. Applications: To save energy decide which application in mobile as energy consume considered as model. The models work as code offloading in MATLAB and determine by two level genetic algorithms. The efficiency of proposed model is evaluated by a simulation and average energy result can be concluded for a mobile device.