Easy To Understand: Java Solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public long maximumValueSum(int[] nums, int k, int[][] edges) {\n        int n = nums.length;\n        long[] getXORDiff = new long[n];\n        for (int i = 0; i < n; ++i)\n            getXORDiff[i] = (nums[i]^k)-nums[i];\n        Arrays.sort(getXORDiff);\n        long maxSum = 0;\n        for (int x : nums)\n            maxSum+=x;\n        for (int i = n-1; i >= 1; i-=2) {\n            if (getXORDiff[i]+getXORDiff[i-1]<0)\n                return maxSum;\n            maxSum += getXORDiff[i]+getXORDiff[i-1];\n        }\n        return maxSum;\n    }\n}\n```
['Java']