Here you can find the source of toByteArray1D(int[][] d)
public static byte[] toByteArray1D(int[][] d)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] toByteArray1D(int[][] d) { byte[] ret = new byte[d.length * d[0].length]; int k = 0; for (int i = 0; i < d.length; i++) { for (int j = 0; j < d[0].length; j++) { ret[k++] = (byte) d[i][j]; }// w w w. j ava 2 s . c o m } return ret; } }