public static long count2SumHits(Long[] sortedArray, long goal) {
        int hits = 0;
        for (int i = 0; i < sortedArray.length - 1; i++) {
            int j = Utils.getLowerBoundToKey(sortedArray, i, sortedArray.length - 1, goal);
            while (j >= 0 && j < sortedArray.length &&  i < sortedArray.length && i <= j)  {
                long sum = sortedArray[i] + sortedArray[j];
                if (sum == goal) {
                    hits++;
                    break;
                }
                if (sum > goal)
                    j--;
                else
                    i++;
            }
        }
        return hits;
    }