Java tutorial
//package com.java2s; public class Main { private static int getMiddleValue(int prev, int next, float factor) { return Math.round((float) prev + (float) (next - prev) * factor); } }