Here you can find the source of arrayInterp(double[] inputArray, double index)
public static double arrayInterp(double[] inputArray, double index)
//package com.java2s; //License from project: Open Source License public class Main { public static double arrayInterp(double[] inputArray, double index) { int cap = inputArray.length - 1; if (index <= 0) { return inputArray[0]; } else if (index >= cap) { return inputArray[cap]; } else {//from w ww . j av a2 s.co m int first = (int) Math.floor(index); double offset = index - first; return offset * inputArray[first + 1] + (1 - offset) * inputArray[first]; } } }