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

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

Description

clamp

License

Open Source License

Declaration

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

Method Source Code

//package com.java2s;

public class Main {
    public static double clamp(double val, double max, double min) {
        return val > max ? max : val < min ? min : val;
    }/*from  w  w w  .j  a va  2  s  . c  o  m*/

    public static float clamp(float val, float max, float min) {
        return val > max ? max : val < min ? min : val;
    }

    public static int clamp(int val, int max, int min) {
        return val > max ? max : val < min ? min : val;
    }

    public static long clamp(long val, long max, long min) {
        return val > max ? max : val < min ? min : val;
    }

    public static short clamp(short val, short max, short min) {
        return val > max ? max : val < min ? min : val;
    }

    public static byte clamp(byte val, byte max, byte min) {
        return val > max ? max : val < min ? min : val;
    }
}

Related

  1. clamp(float n, float minValue, float maxValue)
  2. clamp(float num, float min, float max)
  3. clamp(float v)
  4. clamp(float v, float min, float max)
  5. clamp(float val, float low, float high)
  6. clamp(float val, float min, float max)
  7. clamp(float val, float min, float max)
  8. Clamp(float val, float minVal, float maxVal)
  9. clamp(float value)