Here you can find the source of RangeConvert(float start, float end, float newStart, float newEnd, float value)
public static float RangeConvert(float start, float end, float newStart, float newEnd, float value)
//package com.java2s; //License from project: Open Source License public class Main { public static float RangeConvert(float start, float end, float newStart, float newEnd, float value) { if (value < start || value > end) { System.err.println("Value was outside initial range."); return value; }//from w ww. jav a2s .com double scale = (double) (newEnd - newStart) / (end - start); return (float) (newStart + ((value - start) * scale)); } }