Motorola Solutions interview question

Java fundamentals, Algorithm