Here you can find the source of clipToRange(float[][] in, float min, float max)
public static void clipToRange(float[][] in, float min, float max)
//package com.java2s; //License from project: Open Source License public class Main { public static void clipToRange(float[][] in, float min, float max) { int width = in[0].length; int height = in.length; for (int yy = 0; yy < height; yy++) { for (int xx = 0; xx < width; xx++) { if (in[yy][xx] > max) { in[yy][xx] = max;// w ww . j a v a 2 s .co m } if (in[yy][xx] < min) { in[yy][xx] = min; } } } } public static void clipToRange(float[] in, float min, float max) { int height = in.length; for (int yy = 0; yy < height; yy++) { if (in[yy] > max) { in[yy] = max; } if (in[yy] < min) { in[yy] = min; } } } public static void clipToRange(double[] in, float min, float max) { int height = in.length; for (int yy = 0; yy < height; yy++) { if (in[yy] > max) { in[yy] = max; } if (in[yy] < min) { in[yy] = min; } } } }