Java Integer Clip clip(int val, int from, int to)

Here you can find the source of clip(int val, int from, int to)

Description

clip

License

Mozilla Public License

Declaration

public static int clip(int val, int from, int to) 

Method Source Code

//package com.java2s;
//License from project: Mozilla Public License 

public class Main {
    public static int clip(int val, int from, int to) {
        return val < from ? from : (val > to ? to : val);
    }//from   ww  w .  j a v  a2s  . co  m

    public static long clip(long val, long from, long to) {
        return val < from ? from : (val > to ? to : val);
    }

    public static float clip(float val, float from, float to) {
        return val < from ? from : (val > to ? to : val);
    }

    public static double clip(double val, double from, double to) {
        return val < from ? from : (val > to ? to : val);
    }

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

Related

  1. clip(final int value)
  2. clip(int a, int min, int max)
  3. clip(int lower, int upper, int x)
  4. clip(int val, int from, int to)
  5. clip(int x)
  6. clip(int[][][] data, int startX, int startY, int stopX, int stopY)
  7. clipColor(final int compIn, final boolean allowRGB555)
  8. clipHistogram(final int[] hist, final int[] clippedHist, final int limit)