public class SimpleSearcher
extends java.lang.Object
SimpleSearcher
Java application runs a small test on the
search
method that searches for a specified number in an array.
Java Source Code for this class: http://www.cs.colorado.edu/~main/applications/SimpleSearcher.java
Constructor and Description |
---|
SimpleSearcher() |
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
The main method prints a table of test results, searching for numbers
in an array that contains 2, 4, 6, 8, 10, 12, and 14.
|
static boolean |
search(double[] data,
double target)
Search an array for a specified number.
|
static boolean |
search2(double[] data,
double target)
Search an array for a specified number.
|
public static void main(java.lang.String[] args)
args
- not used in this implementationpublic static boolean search(double[] data, double target)
data
- an array of double numberstarget
- a particular number that we are searching fortrue
(to indicate that target
occurs
somewhere in the array)
or false
(to indicate that target
is not in the array)public static boolean search2(double[] data, double target)
data
- an array of double numberstarget
- a particular number that we are searching fortrue
(to indicate that target
occurs
somewhere in the array)
or false
(to indicate that target
is not in the array)