You can use guava libraries for getting the difference between the
sets.
What you can do is convert bothe the arrays to Set
new HashSet(Arrays.asList(array));
And similalarly for the sencond array as well
Then pass the Sets to guava difference method
public static Sets.SetView difference(Set set1, Set set2)
.If you don't want to use any 3rd party libraries, You can check out
this question
ques

I think the problem is in this line
|
v
new Double(Double.MAX_VALUE).equals(new Double(Double.MAX_VALUE -
99999999999999999999999D))
DOUBLE MAX_VALUE = Double.MAX_VALUE - 99999999999999999999999D
AND you're comparing it with
new Double(Double.MAX_VALUE - 99999999999999999999999D

At first glance, I can't see an algorithm that is less than O(n²).
(Unless it is an extra-ordinarily clever one)
This problem is very similar to the infamous 3SUM question: Basically,
the idea is that given a set of n elements, are there any triples that
sum to zero?
An algorithm solving 3SUM faster than O(n²) is not known - This is an
open problem in computer science... (See here: http://en.