public static byte[] intArrayToByteArray(int[] array) {
byte[] b = new byte[array.length * 4];
for (int i = 0; i < array.length; i++) {
ByteArrayOutputStream boutput = new ByteArrayOutputStream();
DataOutputStream doutput = new DataOutputStream(boutput);
try {
doutput.writeInt(array[i]);
} catch (IOException e) {
e.printStackTrace();
}
byte[] temp = boutput.toByteArray(); for (int j = 0; j < temp.length; j++) {
b[i * 4 + j] = temp[j];
} } return b;
}