Linear search
public class LinearSearch { public int find (final int [] data, final int key) { for (int i = 0; i < data.length; ++ i) { if (data [i] > key) return -1; else if (data [i] == key) return i; } return -1; } }