Java Float Number Clamp clampLevel(float level)

Here you can find the source of clampLevel(float level)

Description

clamp Level

License

Open Source License

Declaration

public static float clampLevel(float level) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static final float UPPER_CLAMP_LIMIT = 0.95f;
    private static final float UPPER_CLAMP_VALUE = 1.0f;
    private static final float LOWER_CLAMP_LIMIT = 0.05f;
    public static final float LOWER_CLAMP_VALUE = 0.05f;

    public static float clampLevel(float level) {
        if (level <= LOWER_CLAMP_LIMIT)
            return LOWER_CLAMP_VALUE;
        if (level >= UPPER_CLAMP_LIMIT)
            return UPPER_CLAMP_VALUE;
        return level;
    }/*w w  w  .j  av  a 2  s.  c  o m*/
}

Related

  1. clampBounds(float[] target, float[] clamp)
  2. clampColour(float value)
  3. clampDegree0To360(float degree)
  4. clampFloat(float value, float minimum, float maximum)
  5. clampLevel(float level)
  6. clampNumberFromTime(long ms, float seconds)
  7. clampPercentage(float value)
  8. clampRoundByte(float in)
  9. clampToMinusOneToOne(float value)