Energy One interview question

A Java coding problem.