Java Double Number Clamp clampMax(double val, double max)

Here you can find the source of clampMax(double val, double max)

Description

clamp Max

License

Open Source License

Declaration

public static double clampMax(double val, double max) 

Method Source Code

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

public class Main {
    public static double clampMax(double val, double max) {
        return val < max ? val : max;
    }// ww  w .j  a v a 2 s  . c o  m

    public static float clampMax(float val, float max) {
        return val < max ? val : max;
    }

    public static long clampMax(long val, long max) {
        return val < max ? val : max;
    }

    public static int clampMax(int val, int max) {
        return val < max ? val : max;
    }

    public static short clampMax(short val, short max) {
        return val < max ? val : max;
    }

    public static byte clampMax(byte val, byte max) {
        return val < max ? val : max;
    }
}

Related

  1. clamp_doubleback(double a, double x, double y)
  2. clamp_latitude(double lat)
  3. clampAngle(double angle)
  4. clampedLerp(double lowerBnd, double upperBnd, double slide)
  5. clampFloat(double in)
  6. clampMax(final double MAX, final double VALUE)
  7. clampMin(double input, double min)
  8. clampRoundShort(double in)
  9. clampToPercentageOrNAN(double input)