Pergunta de entrevista da empresa Siemens Digital Industries Software

Write a function to determine if a number is a power of 2?