Here you can find the source of intArray2Bytes(int[] array)
public static byte[] intArray2Bytes(int[] array)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] intArray2Bytes(int[] array) { byte[] bytes = new byte[array.length * 4]; int byteIndex = 0; int arrayIndex = 0; while (arrayIndex < array.length) { int num = array[arrayIndex++]; bytes[byteIndex++] = (byte) ((num >> 24) & 0xff); bytes[byteIndex++] = (byte) ((num >> 16) & 0xff); bytes[byteIndex++] = (byte) ((num >> 8) & 0xff); bytes[byteIndex++] = (byte) (num & 0xff); }//from w ww . ja va2 s. c o m return bytes; } }