public static 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(numbers[i])){
                if(target == numbers[i] * 2){
                    result[0] = map.get(numbers[i]) + 1;
                    result[1] = i + 1;
                    return  result;
                }
            }else{
                map.put(numbers[i], i);
            }
        }

        Arrays.sort(numbers);

        int i = 0, j = numbers.length - 1;
        while(i < j){
            if(numbers[i] + numbers[j] > target){
                j--;
            }else if(numbers[i] + numbers[j] < target){
                i++;
            }else{
                result[0] = Math.min(map.get(numbers[i]) + 1, map.get(numbers[j]) + 1);
                result[1] = Math.max(map.get(numbers[i]) + 1, map.get(numbers[j]) + 1);
                return result;
            }
        }
        return result;
    }