volume method Null safety
Implementation
static int volume(Box cube, List<int> moment) {
return (moment[getIndex(cube.r1, cube.g1, cube.b1)] -
moment[getIndex(cube.r1, cube.g1, cube.b0)] -
moment[getIndex(cube.r1, cube.g0, cube.b1)] +
moment[getIndex(cube.r1, cube.g0, cube.b0)] -
moment[getIndex(cube.r0, cube.g1, cube.b1)] +
moment[getIndex(cube.r0, cube.g1, cube.b0)] +
moment[getIndex(cube.r0, cube.g0, cube.b1)] -
moment[getIndex(cube.r0, cube.g0, cube.b0)]);
}