I will share that How do I do it since Java 7 -
Long first = 12345L, second = 123L;
System.out.println(first.equals(second));
output returned : false
and second example of match is -
Long first = 12345L, second = 12345L;
System.out.println(first.equals(second));
output returned : true
So, I believe in equals method for comparing Object's value, Hope it helps you, thanks.