Your task is to implement the method search in the class BinaryGenericSearch using generics.


The method search searches over a given array and returns true, if the value to search for is found.

Implement a binary search. If needed you can add further (private) methods to the class BinarySearch.


See Binary Search Algorithm.


To support you with implementing the method there are unit tests in BinaryGenericSearchTest. The unit tests are disabled at the start. To use them you have to enable them.

Further Challenges

If you solved this exercise already and want a new challenge you can solve this exercise with one of the following constraints:

  • If you implemented the binary search with a recursive algorithm then create an iterative implementation.
  • If you implemented the binary search with an iterative algorithm then create a recursive implementation.
  • Implement the method without using an additional method.

Development Requirements

To perform this exercise you need a JDK 8 and Maven 3.3.x.