Java Float Number Clamp clamp(float min, float max, float val)

Here you can find the source of clamp(float min, float max, float val)

Description

clamp

License

LGPL

Declaration

public static float clamp(float min, float max, float val) 

Method Source Code

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

public class Main {
    public static float clamp(float min, float max, float val) {
        float _min = Math.min(min, max);
        float _max = Math.max(min, max);
        return Math.max(Math.min(val, _max), _min);
    }//from  ww  w.  j  av  a  2 s . c o m
}

Related

  1. Clamp(float a, float min, float max)
  2. clamp(float f)
  3. clamp(float f, float min, float max)
  4. clamp(float f, float min, float max)
  5. clamp(float input, float min, float max)
  6. clamp(float min, float max, float value)
  7. clamp(float min, float x, float max)
  8. clamp(float n, float minValue, float maxValue)
  9. clamp(float num, float min, float max)