Java Double Number Clamp clamp255d(double d)

Here you can find the source of clamp255d(double d)

Description

clampd

License

Open Source License

Declaration

public static int clamp255d(double d) 

Method Source Code

//package com.java2s;
/*/*from   w ww.ja v a 2  s .  c o  m*/
 * JaamSim Discrete Event Simulation
 * Copyright (C) 2012 Ausenco Engineering Canada Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

public class Main {
    public static int clamp255d(double d) {
        return clamp255((int) d);
    }

    public static int clamp255(int i) {
        if (i < 0)
            return 0;
        if (i > 255)
            return 255;
        return i;
    }
}

Related

  1. clamp(double x, double xMin, double xMax)
  2. clamp(final double value, final double min, final double max)
  3. clamp(final double value, final double min, final double max)
  4. clamp01(double d)
  5. clamp01(double value)
  6. clamp_double(double num, double min, double max)
  7. clamp_double(double p_151237_0_, double p_151237_2_, double p_151237_4_)
  8. clamp_doubleback(double a, double x, double y)
  9. clamp_latitude(double lat)