Java Integer Clamp clamp(int v, int min, int max)

Here you can find the source of clamp(int v, int min, int max)

Description

clamp

License

Open Source License

Declaration

static public int clamp(int v, int min, int max) 

Method Source Code

//package com.java2s;

public class Main {
    static public int clamp(int v, int min, int max) {
        if (v < min)
            v = min;//from www.  j  a v  a 2 s . c  o  m
        if (v > max)
            v = max;
        return v;
    }

    static public double clamp(double v, double min, double max) {
        if (v < min)
            v = min;
        if (v > max)
            v = max;
        return v;
    }
}

Related

  1. clamp(int n, int min, int max)
  2. clamp(int n, int min, int max)
  3. clamp(int num, int min, int max)
  4. clamp(int number, int low, int high)
  5. clamp(int ptr, int size)
  6. clamp(int v, int min, int max)
  7. clamp(int v, int min, int max)
  8. clamp(int val, int min, int max)
  9. clamp(int value, final int minimum, final int maximum)