Here you can find the source of normalize(float[][] vals, float min, float max)
public static void normalize(float[][] vals, float min, float max)
//package com.java2s; //License from project: Creative Commons License public class Main { public static void normalize(float[][] vals, float min, float max) { final float divider = max - min + 1; for (int xx = 0; xx < vals.length; xx++) { for (int zz = 0; zz < vals[xx].length; zz++) { vals[xx][zz] = clamp(vals[xx][zz], min, max); vals[xx][zz] -= min;/*ww w . ja va 2 s . c o m*/ vals[xx][zz] /= divider; } } } public static float clamp(float val, float min, float max) { if (val < min) { return min; } else if (val > max) { return max; } return val; } }