applications
Class BinarySearch

java.lang.Object
  |
  +--applications.BinarySearch

public class BinarySearch
extends java.lang.Object


Constructor Summary
BinarySearch()
           
 
Method Summary
static int binarySearch(java.lang.Comparable[] a, java.lang.Comparable x)
          Search the ordered array a for x.
static void main(java.lang.String[] args)
          test program
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinarySearch

public BinarySearch()
Method Detail

binarySearch

public static int binarySearch(java.lang.Comparable[] a,
                               java.lang.Comparable x)
Search the ordered array a for x. CAUTION: Object.equals must be overriden for this method to work correctly
Returns:
position of x if found; -1 otherwise

main

public static void main(java.lang.String[] args)
test program