Implemented a 'From the sides' search in Java