BinarySearch returns -1 for an index on failure. If you search for "kitten" and hit the second array for "puppy" there is no resulting match. Work wise, this is easier using a single loop.
PHP Code:
public String ChangefromAnimal1toAnimal2(String aString)
{
String sResult = "";
for (int r = 0; r < Farm.animals.length && sResult.isEmpty(); r++)
{
if (animals[r][0].equals(aString))
{
sResult = animals[r][1];
}
}
return sResult;
}
Also consider using a Hashtable to associate "kitten" with "cat" for easier lookups.
Edit:
BTW, you'd never get the OutOfBounds exception. There are two compile time errors here, one for the import statement, and one for not returning a String from your method.