public static Color[] buildGradient(Color[] colors, double maxShift) {
		
		if(colors.length < 2) {
			return colors;
		}
		int[] steps = new int[colors.length-1];
		for(int i = 0; i < steps.length; ++i) {
			double maxDifference = Math.abs(colors[i].getRed()-colors[i+1].getRed());
			if(maxDifference < Math.abs(colors[i].getGreen()-colors[i+1].getGreen()))
				maxDifference = Math.abs(colors[i].getGreen()-colors[i+1].getGreen());
			if(maxDifference < Math.abs(colors[i].getBlue()-colors[i+1].getBlue()))
				maxDifference = Math.abs(colors[i].getBlue()-colors[i+1].getBlue());
			steps[i] = (int)(((maxDifference*255.0)/(double)maxShift)+.5);
		}	
		return buildGradient(colors, steps);
	}