sbool iiSumRect_debug = true; static double iiSumRect(double[][] ii, Rect r) { double bottomLeft = ii[r.y2()-1][r.x-1]; double bottomRight = ii[r.y2()-1][r.x2()-1]; double topLeft = ii[r.y-1][r.x-1]; double topRight = ii[r.y-1][r.x2()-1]; if (iiSumRect_debug) printVars(+topLeft, +topRight, +bottomLeft, +bottomRight); //ret bottomRight-topLeft-(topRight-topLeft)-(bottomLeft-topLeft); ret bottomRight+topLeft-(topRight+bottomLeft); }