i agree with @shmosel solution. But it’s true just when second number has only 3 digits.
boolean compareTail(long one, long two) {
int digits =(int) Math.log10(two)+1;
long formated = one % ((long) Math.pow(10, digits));
return formated == two;
}