Java tutorial
//package com.java2s; public class Main { public static int interpolate(int inMin, int inMax, int outMin, int outMax, int value) { return (int) ((float) outMin + ((float) value * (float) (outMax - outMin)) / (float) (inMax - inMin)); } public static void interpolate(float hsl1[], float hsl2[], float amount, float hslOut[]) { int size = Math.min(hsl1.length, hsl2.length); for (int i = 0; i < size; i++) hslOut[i] = hsl1[i] + amount * (hsl2[i] - hsl1[i]); } }