On the very page that you are linking to, you need to pass a 5 by 5 array to this constructor. You pass a 4 by 4 array, so naturally you get an IndexOutOfBoundsException .
Try
float[][] colorMatrixElements = { new float[] {rScale, 0, 0, 0, 0}, new float[] {0, gScale, 0, 0, 0}, new float[] {0, 0, bScale, 0, 0}, new float[] {0, 0, 0, 1, 0}, new float[] {0, 0, 0, 0, 1} }; ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElements);
source share