[Java] Easy to understand
\n    public int largestSumAfterKNegations(int[] A, int K) {\n        Arrays.sort(A);\n        int sum = 0;\n\n        for(int i = 0; i < A.length && K > 0 && A
```\n    public int largestSumAfterKNegations(int[] A, int K) {\n        Arrays.sort(A);\n        int sum = 0;\n\n        for(int i = 0; i < A.length && K > 0 && A[i] < 0; i++){\n            A[i] = -A[i];\n            K--;\n        }\n\n        Arrays.sort(A);\n        for(int a : A) sum+= a;\n        if(K > 0 && K % 2 == 1){\n            sum -= A[0] * 2;\n        }\n        return sum;\n    }\n```
[]