[Java] Sort + Two Pointers
```\nclass Solution {\n    public int[] getStrongest(int[] arr, int k) {\n        int n = arr.length;\n        Arrays.sort(arr);\n        int mid = (n - 1) / 2;
```\nclass Solution {\n    public int[] getStrongest(int[] arr, int k) {\n        int n = arr.length;\n        Arrays.sort(arr);\n        int mid = (n - 1) / 2;\n        int left = 0, right = n - 1, count = 0;\n        int[] ans = new int[k];\n        int it = 0;\n        while(count < k && left <= right) {\n            count++;\n            int x = Math.abs(arr[mid] - arr[left]), y = Math.abs(arr[mid] - arr[right]);\n            if(x > y) ans[it++] = arr[left++];\n            else ans[it++] = arr[right--];\n        }\n        return ans;\n    }\n}
[]