Searching through a contact list for given criteria
If you are limited to use only Arrays, you can create a interface like this

public static interface Checker {
    public boolean check(Person p, String searchString);
}


Create a Checker for every type of comparison you want.

And compare with the Checker

for (int x = 0; x &lt; numberOfContacts; x++) {
    if (checker.check(contacts[x], searchString)) {
        results[found] = x;
        found++;
    }
}


You can see a working example here (with your classes and methos): http://ideone.com/2C6kei

Note:
With this method is easy to expand the search criteria (as you see in the example, with a anywhere Checker).