code: protected void initialize() {
  		rows = cols = (int)Math.sqrt(matrix.length);
  		map = new int[levels];
  		for (int i = 0; i < levels; i++) {
  			int v = 255 * i / (levels-1);
  			map[i] = v;
  		}
  		div = new int[256];
  		mod = new int[256];
  		int rc = (rows*cols+1);
  		for (int i = 0; i < 256; i++) {
  			div[i] = (levels-1)*i / 256;
  			mod[i] = i*rc/256;
  		}
  	}
docs: Initialize the filter.