@@ -0,0 +1,744 @@
+package org.psjava.algo.search;%0D%0A%0D%0Aimport junit.framework.Assert;%0D%0A%0D%0Aimport org.junit.Test;%0D%0Aimport org.psjava.ds.array.MutableArrayUsingIntArray;%0D%0Aimport org.psjava.javautil.DefaultComparator;%0D%0A%0D%0Apublic class BinarySearchExample %7B%0D%0A%0D%0A%09// TODO complemet cases%0D%0A%0D%0A%09@Test%0D%0A%09public void searchInNormalArray() %7B%0D%0A%09%09int%5B%5D a = %7B 1, 3, 5, 7, 9 %7D;%0D%0A%09%09int res = BinarySearchFirstInArray.search(MutableArrayUsingIntArray.wrap(a), 5, new DefaultComparator%3CInteger%3E(), -1);%0D%0A%09%09Assert.assertEquals(2, res);%0D%0A%09%7D%0D%0A%0D%0A%09@Test%0D%0A%09public void searchInReversedArray() %7B%0D%0A%09%09int%5B%5D a = %7B 9, 7, 5, 3, 1 %7D;%0D%0A%09%09int res = BinarySearchFirstInArray.search(MutableArrayUsingIntArray.wrap(a), 3, new DefaultComparator%3CInteger%3E(), -1);%0D%0A%09%09Assert.assertEquals(3, res);%0D%0A%09%7D%0D%0A%0D%0A%7D%0D%0A

add a example