Here you can find the source of toByteArray(double[][] array)
public static byte[][] toByteArray(double[][] array)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[][] toByteArray(double[][] array) { int nr = array.length; int nc = array[0].length; byte[][] ret = new byte[nr][nc]; for (int i = 0; i < nr; i++) { for (int j = 0; j < nc; j++) { ret[i][j] = (byte) array[i][j]; }//from ww w . jav a2 s .com } return ret; } public static byte[][] toByteArray(float[][] array) { int nr = array.length; int nc = array[0].length; byte[][] ret = new byte[nr][nc]; for (int i = 0; i < nr; i++) { for (int j = 0; j < nc; j++) { ret[i][j] = (byte) array[i][j]; } } return ret; } public static byte[][] toByteArray(int[][] array) { int nr = array.length; int nc = array[0].length; byte[][] ret = new byte[nr][nc]; for (int i = 0; i < nr; i++) { for (int j = 0; j < nc; j++) { ret[i][j] = (byte) array[i][j]; } } return ret; } public static byte[][] toByteArray(long[][] array) { int nr = array.length; int nc = array[0].length; byte[][] ret = new byte[nr][nc]; for (int i = 0; i < nr; i++) { for (int j = 0; j < nc; j++) { ret[i][j] = (byte) array[i][j]; } } return ret; } public static byte[][] toByteArray(short[][] array) { int nr = array.length; int nc = array[0].length; byte[][] ret = new byte[nr][nc]; for (int i = 0; i < nr; i++) { for (int j = 0; j < nc; j++) { ret[i][j] = (byte) array[i][j]; } } return ret; } public static byte[][] toByteArray(String[][] array) { int nr = array.length; int nc = array[0].length; byte[][] ret = new byte[nr][nc]; for (int i = 0; i < nr; i++) { for (int j = 0; j < nc; j++) { ret[i][j] = Byte.parseByte(array[i][j]); } } return ret; } }