private void calculateSingleArrayGradient
            (Color[] loColors, Color[] hiColors, float Imin) {

        //set the flag so we know later it is a non-simple lookup
        isSimpleLookup = true;

        int gradientsTot = 1; //the eventual size of the single array

        // These are fixed point 8.16 (start with 0.5)
        int aveA = 0x008000;
        int aveR = 0x008000;
        int aveG = 0x008000;
        int aveB = 0x008000;

        //for every interval (transition between 2 colors)
        for (int i = 0; i < gradients.length; i++) {

            //create an array whose size is based on the ratio to the
            //smallest interval.
            int nGradients = (int) ((normalizedIntervals[i] / Imin) * 255f);
            gradientsTot += nGradients;
            gradients[i] = new int[nGradients];

            //the the 2 colors (keyframes) to interpolate between
            int rgb1 = loColors[i].getRGB();
            int rgb2 = hiColors[i].getRGB();

            //fill this array with the colors in between rgb1 and rgb2
            interpolate(rgb1, rgb2, gradients[i]);

            // Calculate Average of two colors...
            int argb = gradients[i][GRADIENT_SIZE / 2];
            float norm = normalizedIntervals[i];
            aveA += (int) (((argb >> 8) & 0xFF0000) * norm);
            aveR += (int) (((argb) & 0xFF0000) * norm);
            aveG += (int) (((argb << 8) & 0xFF0000) * norm);
            aveB += (int) (((argb << 16) & 0xFF0000) * norm);

            //if the colors are opaque, transparency should still be 0xff000000
            transparencyTest &= rgb1 & rgb2;
        }

        gradientAverage = (((aveA & 0xFF0000) << 8) |
                ((aveR & 0xFF0000)) |
                ((aveG & 0xFF0000) >> 8) |
                ((aveB & 0xFF0000) >> 16));

        // Put all gradients in a single array
        gradient = new int[gradientsTot];
        int curOffset = 0;
        for (int i = 0; i < gradients.length; i++) {
            System.arraycopy(gradients[i], 0, gradient,
                    curOffset, gradients[i].length);
            curOffset += gradients[i].length;
        }
        gradient[gradient.length - 1] = hiColors[hiColors.length - 1].getRGB();

        //if interpolation occurred in Linear RGB space, convert the
        //gradients back to SRGB using the lookup table
        if (colorSpace == LinearGradientPaint.LINEAR_RGB) {
            if (dataModel.getColorSpace() ==
                    ColorSpace.getInstance(ColorSpace.CS_sRGB)) {
                for (int i = 0; i < gradient.length; i++) {
                    gradient[i] =
                            convertEntireColorLinearRGBtoSRGB(gradient[i]);
                }
                gradientAverage =
                        convertEntireColorLinearRGBtoSRGB(gradientAverage);
            }
        } else {
            if (dataModel.getColorSpace() ==
                    ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB)) {
                for (int i = 0; i < gradient.length; i++) {
                    gradient[i] =
                            convertEntireColorSRGBtoLinearRGB(gradient[i]);
                }
                gradientAverage =
                        convertEntireColorSRGBtoLinearRGB(gradientAverage);
            }
        }

        fastGradientArraySize = gradient.length - 1;
    }