private long Bottom(Box cube, int dir, long mmt[][][]) {
    		/* Compute part of Vol(cube, mmt) that doesn't depend on r1, g1, or b1 */
    		/* (depending on dir) */
    		switch(dir) {
    			case RED:
    				return( -mmt[cube.r0][cube.g1][cube.b1]
    						+mmt[cube.r0][cube.g1][cube.b0]
    						+mmt[cube.r0][cube.g0][cube.b1]
    						-mmt[cube.r0][cube.g0][cube.b0] );
    			case GREEN:
    				return( -mmt[cube.r1][cube.g0][cube.b1]
    						+mmt[cube.r1][cube.g0][cube.b0]
    						+mmt[cube.r0][cube.g0][cube.b1]
    						-mmt[cube.r0][cube.g0][cube.b0] );
    			case BLUE:
    				return( -mmt[cube.r1][cube.g1][cube.b0]
    						+mmt[cube.r1][cube.g0][cube.b0]
    						+mmt[cube.r0][cube.g1][cube.b0]
    						-mmt[cube.r0][cube.g0][cube.b0] );
    			default:
    				return 0;
    		}
    	}
Java port of
C Implementation of Wu's Color Quantizer (v. 2)
(see Graphics Gems vol. II, pp. 126-133)
Author:	Xiaolin Wu
Dept. of Computer Science
Univ. of Western Ontario
London, Ontario N6A 5B7
wu@csd.uwo.ca

Algorithm: Greedy orthogonal bipartition of RGB space for variance
minimization aided by inclusion-exclusion tricks.
For speed no nearest neighbor search is done. Slightly
better performance can be expected by more sophisticated
but more expensive versions.

The author thanks Tom Lane at Tom_Lane@G.GP.CS.CMU.EDU for much of
additional documentation and a cure to a previous bug.

Free to distribute, comments and suggestions are appreciated.
subs/gif-revert/src/main/java/com/engineer/gif/revert/lib/AnimatedGIFWriter.java