Fidelity Investments interview question

Work on Java