Java tutorial
//package com.java2s; //License from project: Apache License public class Main { public static byte[] intArrayToByteArray(int[] buffer) { byte[] buf = new byte[buffer.length * 4]; byte[] bf; for (int i = 0; i < buffer.length; i++) { bf = intToByteArray(buffer[i]); System.arraycopy(bf, 0, buf, i * 4, 4); } return buf; } public static byte[] intToByteArray(int value) { return new byte[] { (byte) (value >>> 24), (byte) (value >>> 16), (byte) (value >>> 8), (byte) value }; } }