Java Utililty Methods Integer Clip

List of utility methods to do Integer Clip

  1. HOME
  2. Java
  3. I
  4. Integer Clip

Description

The list of methods to do Integer Clip are organized into topic(s).

Method

int clip(final int value)
Clip a value for compare
if (value <= -1) {
 return -1;
if (value >= 1) {
 return 1;
return 0;
int clip(int a, int min, int max)
clip
return a < min ? min : (a > max ? max : a);
int clip(int lower, int upper, int x)
Clips a value within a range.
return Math.min(Math.max(x, lower), upper);
int clip(int val, int from, int to)
clip
return val < from ? from : (val > to ? to : val);
int clip(int val, int from, int to)
clip
return val < from ? from : (val > to ? to : val);
int clip(int x)
clip
if (x < 0)
 return 0;
if (x > 255)
 return 255;
return x;
void clip(int[][][] data, int startX, int startY, int stopX, int stopY)
This method clips the values of the pixel so that they are in the range 0-255
for (int y = startY; y < stopY; y++) {
 for (int x = startX; x < stopX; x++) {
 data[y][x][1] = clip(data[y][x][1]);
 data[y][x][2] = clip(data[y][x][2]);
 data[y][x][3] = clip(data[y][x][3]);
int clipColor(final int compIn, final boolean allowRGB555)
clip Color
final int compOut;
if (5 < compIn || !allowRGB555) {
 compOut = 8;
} else {
 compOut = 5;
return compOut;
void clipHistogram(final int[] hist, final int[] clippedHist, final int limit)
Clip histogram and redistribute clipped entries.
System.arraycopy(hist, 0, clippedHist, 0, hist.length);
int clippedEntries = 0, clippedEntriesBefore;
do {
 clippedEntriesBefore = clippedEntries;
 clippedEntries = 0;
 for (int i = 0; i < hist.length; ++i) {
 final int d = clippedHist[i] - limit;
 if (d > 0) {
...
int clipInt(int value, int max)
clip Int
return clipInt(value, 0, max);


AltStyle によって変換されたページ (->オリジナル) /