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

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

Description

clamp

License

LGPL

Declaration

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

Method Source Code

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

public class Main {
    public static int clamp(int a, int min, int max) {

        return a < min ? min : (a > max ? max : a);
    }/*from  w w  w .j  ava 2 s.c  om*/

    public static float clamp(float a, float min, float max) {

        return a < min ? min : (a > max ? max : a);
    }

    public static double clamp(double a, double min, double max) {

        return a < min ? min : (a > max ? max : a);
    }
}

Related

  1. clamp(final float num, final float bound1, final float bound2)
  2. clamp(final float v, final float min, final float max)
  3. clamp(final float val, final float min, final float max)
  4. clamp(final float value, final float min, final float max)
  5. clamp(final float x, final float a, final float b)
  6. Clamp(float a, float min, float max)
  7. clamp(float f)
  8. clamp(float f, float min, float max)
  9. clamp(float f, float min, float max)