best solution in java
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```java []\nclass Solution {\n  public long maxMatrixSum(int[][] matrix) {\n    long absSum = 0;\n    int minAbs = Integer.MAX_VALUE;\n    // 0 := even number of negatives\n    // 1 := odd number of negatives\n    int oddNeg = 0;\n\n    for (int[] row : matrix)\n      for (final int num : row) {\n        absSum += Math.abs(num);\n        minAbs = Math.min(minAbs, Math.abs(num));\n        if (num < 0)\n          oddNeg ^= 1;\n      }\n\n    return absSum - oddNeg * minAbs * 2;\n  }\n}\n```
['Java']