Android Float Clamp clamp(float min, float max, float value)

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

Description

clamp

License

Open Source License

Declaration

private static float clamp(float min, float max, float value) 

Method Source Code

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

public class Main {
    private static float clamp(float min, float max, float value) {
        final float clamp;
        if (value < min) {
            clamp = min;/*from ww w  .j a  va 2  s .  c o m*/
        } else if (value > max) {
            clamp = max;
        } else {
            clamp = value;
        }
        return clamp;
    }
}

Related

  1. clamp(float x, float min, float max)
  2. clampByte(float value)