Here you can find the source of clampByte(int in)
public static final byte clampByte(int in)
//package com.java2s; /*/*from w w w . j a v a2 s .co m*/ * $RCSfile: ImageUtil.java,v $ * * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. * * Use is subject to license terms. * * $Revision: 1.2 $ * $Date: 2006/07/21 20:53:28 $ * $State: Exp $ */ public class Main { /** Clamps a number to the range supported by byte data type. */ public static final byte clampByte(int in) { return (in > 0xFF ? (byte) 0xFF : (in >= 0 ? (byte) in : (byte) 0)); } }