Here you can find the source of toByte(float[][] in, byte[] out, float min, float max)
public static void toByte(float[][] in, byte[] out, float min, float max)
//package com.java2s; //License from project: Open Source License public class Main { public static void toByte(float[][] in, byte[] out, 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++) { out[yy * width + xx] = (byte) (255 * (in[yy][xx] - min) / (max - min)); }/* ww w .j ava 2 s. c o m*/ } } public static void toByte(float[] in, byte[] out, float min, float max) { int height = in.length; for (int yy = 0; yy < height; yy++) { out[yy] = (byte) (255 * (in[yy] - min) / (max - min)); } } public static void toByte(double[] in, byte[] out, float min, float max) { int height = in.length; for (int yy = 0; yy < height; yy++) { out[yy] = (byte) (255 * (in[yy] - min) / (max - min)); } } }