Here you can find the source of intArrayToByteArray(int[] data)
public static byte[] intArrayToByteArray(int[] data)
//package com.java2s; //License from project: Apache License public class Main { /** unpack an array of ints into an array of bytes */ public static byte[] intArrayToByteArray(int[] data) { byte res[] = new byte[data.length]; for (int i = 0; i < data.length; ++i) { res[i] = (byte) data[i]; }//from ww w . j a v a 2s.c o m return res; } }