/*
 * Problem: https://leetcode.com/problems/two-sum/
 *
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
public int[] twoSum(int[] numbers, int target) {
    int[] result = new int[2];
    Map<Integer, Integer> map = new HashMap<Integer, Integer>();
    for (int i = 0; i < numbers.length; i++) {
        if (map.containsKey(target - numbers[i])) {
            result[1] = i + 1;
            result[0] = map.get(target - numbers[i]);
            return result;
        }
        map.put(numbers[i], i + 1);
    }
    return result;
}
@@ -157,19 +157,16 @@
 nt%5B%5D num
-ber
 s, int t
@@ -178,39 +178,8 @@
 ) %7B%0A
-    int%5B%5D result = new int%5B2%5D;%0A
     
@@ -218,32 +218,16 @@
 HashMap%3C
-Integer, Integer
 %3E();%0A   
@@ -250,19 +250,16 @@
  i %3C num
-ber
 s.length
@@ -280,27 +280,24 @@
    i
-f (map.containsKey(
+nt complement = 
 targ
@@ -308,30 +308,22 @@
  num
-ber
 s%5Bi%5D
-)) %7B%0A  
+;%0A
         
   re
@@ -322,28 +322,42 @@
     
-  result%5B1%5D = i + 1;
+if (map.containsKey(complement)) %7B
 %0A   
@@ -371,17 +371,24 @@
   re
-sul
+turn new in
 t%5B
-0
 %5D 
-=
+%7B
  map
@@ -396,55 +396,24 @@
 get(
-target - numbers%5Bi%5D);%0A            return result
+complement), i %7D
 ;%0A  
@@ -443,22 +443,15 @@
 (num
-ber
 s%5Bi%5D, i
- + 1
 );%0A 
@@ -463,20 +463,64 @@
     
-return result
+throw new IllegalArgumentException(%22No two sum solution%22)
 ;%0A%7D

Use compact style java hash solution.