Java Integer Clamp clamp(int a)

Here you can find the source of clamp(int a)

Description

clamp

License

LGPL

Declaration

public static int clamp(int a) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    public static int clamp(int a) {
        if (a < 0) {
            return 0;
        } else if (a > 0xff) {
            return 0xff;
        }/*from  ww w  .  j a v  a 2  s .  com*/
        return a;
    }

    public static double clamp(double a) {
        if (a < 0) {
            return 0;
        } else if (a > 0xff) {
            return 0xff;
        }
        return a;
    }
}

Related

  1. clamp(final int min, final int x, final int max)
  2. clamp(final int value, final int min, final int max)
  3. clamp(final int value, final int min, final int max)
  4. clamp(int a, int x, int b)
  5. clamp(int a, int x, int y)
  6. clamp(int amt, int low, int high)
  7. clamp(int c)