Here you can find the source of absCap(double value, double bounds)
public static double absCap(double value, double bounds)
//package com.java2s; //License from project: Open Source License public class Main { /**//w w w.j a va2 s .co m * Caps a value between -bounds to +bounds * * @return A value capped between two bounds. */ public static double absCap(double value, double bounds) { return Math.min(Math.max(value, -bounds), bounds); } public static float absCap(float value, float bounds) { return Math.min(Math.max(value, -bounds), bounds); } }