Here you can find the source of truncate(final double value, final double min, final double max)
public static double truncate(final double value, final double min, final double max)
//package com.java2s; //License from project: Open Source License public class Main { public static double truncate(final double value, final double min, final double max) { return Math.min(Math.max(value, min), max); }//from w w w . j av a 2s .co m }