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); double lShape = bottomRight-topLeft; double topRightSegment = topRight-topLeft; double bottomLeftSegment = bottomLeft-topLeft; //ret -(lShape-topRightSegment-bottomLeftSegment); //ret bottomRight-bottomLeft-topRight+topLeft; ret bottomRight-topLeft-(topRight-topLeft)-(bottomLeft-topLeft); }