Easy way of using PriorityQueue. - JAVA
\nclass Solution {\n    public int largestSumAfterKNegations(int[] A, int K) {\n        \n        //Using of min heap.\n        //Min heap by default.\n        
```\nclass Solution {\n    public int largestSumAfterKNegations(int[] A, int K) {\n        \n        //Using of min heap.\n        //Min heap by default.\n        PriorityQueue<Integer> pq = new PriorityQueue<>();\n        for(int i=0;i<A.length;i++)\n            pq.add(A[i]);\n        int start = 0;\n        while(start<K)\n        {\n            int min_value = pq.poll();\n            pq.add(min_value*(-1));\n            start++;\n        }\n        int sum = 0;\n        while(!pq.isEmpty())\n            sum = sum + pq.poll();\n        \n        return sum;\n    }\n}\n```
[]