add Java solution for implementing a power function based on only addition