Java Array Sum summedDifference(int[][] matrix, short topX, short botX, short row)

Here you can find the source of summedDifference(int[][] matrix, short topX, short botX, short row)

Description

summed Difference

License

Open Source License

Declaration

public static int summedDifference(int[][] matrix, short topX,
            short botX, short row) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Arrays;

public class Main {
    public static int summedDifference(int[][] matrix, short topX,
            short botX, short row) {
        int n = matrix[0].length - 1;
        int sums[] = new int[4];
        sums[1] = matrix[topX][row];/*w  w  w  .  jav a  2s  .  c  om*/
        sums[0] = matrix[n][row] - sums[1];
        sums[2] = matrix[botX][n] - matrix[botX][row];
        sums[3] = matrix[n][n] - sums[0] - sums[2] - sums[1];
        Arrays.sort(sums);
        return sums[3] - sums[0];
    }
}

Related

  1. sumLong(int[] array)
  2. summarizeIntegerArray(int[] numbers)
  3. summarizeNumbersAsString(int[] numbers)
  4. summation(double[] values)
  5. sumMaxK(double[] x, int k)
  6. sumMinMax(double[] values, int out[])
  7. sumMult(double[] aArray1, double[] aArray2)
  8. sumNaive(final double... values)
  9. sumOf(int... values)