Create efficient implementation of the power function in Java