Java Integer Clamp clampByte(int in)

Here you can find the source of clampByte(int in)

Description

Clamps a number to the range supported by byte data type.

License

Open Source License

Declaration

public static final byte clampByte(int in) 

Method Source Code

//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));
    }
}

Related

  1. clamp(int x, int min, int max)
  2. clamp(String string, int maxChars)
  3. clamp_int(int num, int min, int max)
  4. clamp_wrap(int a, int x, int y)
  5. clampAngle(int angle)
  6. clampColor(int c)
  7. clampColorInt(int color)
  8. CLAMPED_Wr(long ITERW, int FBZCP)
  9. clampI(int a, int min, int max)