Here you can find the source of clip(int val, int from, int to)
public static final int clip(int val, int from, int to)
//package com.java2s; /**/*from w w w. j a v a 2s .c om*/ * This class is part of JCodec ( www.jcodec.org ) This software is distributed * under FreeBSD License * * @author The JCodec project * */ public class Main { public static final int clip(int val, int from, int to) { return val < from ? from : (val > to ? to : val); } }