EPAM Systems interview question

Java code solutions to fill in