Linear search of an array of keys for an item examines each array element until the item is found or until all array elements have been compared with no match.
For examle, assuming the keys are of type int, this rank function returns the array index where item is found or -1 if not found.
public int rank(int[] keys, int item) { for(int i = 0; i < keys.length; i++) { if ( item == keys[i] ) { return i; } } return -1; }