Checking whether a timestamp is 10 minutes old
Your description says that you want to check whether the searchTimestamp is less than 10 minutes old. Your code does something different, though.

Your code checks whether there's less than 10 minutes between the times (the difference is &lt;= 10 minutes .... If the searchTimestamp is 2 minutes in the future, it will pass the test, if it is 9 minutes in the future, it will pass the test, and if it is 11 minutes in the future, it will fail the test.

Of interest, the math you use does a 10 minute check, but the message says "greater than 5 minutes old."

Your message should say: "timestamp is older than 10 minutes, or more than 10 minutes in the future"

So, changing your code to be what I think it should be, is a lot simpler than you would think.

What you want is for the searchTimestamp to have happened sometime after 10 minutes ago.... this is the way to do it:

private static final int TEN_MINUTES = 10 * 60 * 1000;


then, in your method:

long tenAgo = System.currentTimeMillis() - TEN_MINUTES;
if (searchTimestamp &lt; tenAgo) {
    System.out.println("searchTimestamp is older than 10 minutes");
}