Find two numbers that add up to target
If the size of your input array can be large, you can get a speed-up by preallocating the capacity of your HashMap:

Map&lt;Integer, Integer&gt; numbersMap = new HashMap&lt;Integer, Integer&gt;(numbers.length * 2);


As the algorithm runs, data will be added to the HashMap.  When number of entries exceeds the capacity * load_factor, the hashmap's capacity is doubled, and the elements are re-binned for the larger capacity.  This capacity doubling and rebinning takes time.  It doesn't happen often, \$O(\log N)\$ times, but it can be eliminated by starting with a hashmap of sufficient capacity.

The load_factor defaults to 0.75, so an initial capacity larger than numbers.length * 4/3 is required.  numbers.length * 2 is a simple expression that satisfies that requirement.