Here you can find the source of intToByte(int[] intArray)
public static byte[] intToByte(int[] intArray)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; import java.nio.IntBuffer; public class Main { public static byte[] intToByte(int[] intArray) { ByteBuffer byteBuffer = ByteBuffer.allocate(intArray.length * 4); IntBuffer intBuffer = byteBuffer.asIntBuffer(); intBuffer.put(intArray);//from w w w.j a v a 2 s.c o m byte[] array = byteBuffer.array(); return array; } }