EDIT ... the Java version!!! (I have no Java compiler handy right now but I think this is right...)
At the second line of your code, we compute the reverse string; there are thousands of ways to do this, but this one is pretty self-explanatory (I am assuming there is no white space in your string...):
int ls = search.length(); // length of initial string
StringBuilder sb = new StringBuilder(); // temporary place to store growing string
for(int ii=ls-1;ii>=0; ii--) {
sb.append(search.charAt(ii)); // build the string one character at a time
}
hcraes = sb.toString(); // convert to "regular" string
Now, at every point where you have the line
if (temp.equals(search))
change that line to
if (temp.equals(search) || temp.equals(hcraes))
that should do the trick.