Here you can find the source of toByteArray(int[] array)
public static byte[] toByteArray(int[] array)
//package com.java2s; //License from project: LGPL public class Main { public static byte[] toByteArray(int[] array) { byte[] data = new byte[array.length]; for (int i = 0; i < array.length; i++) { data[i] = (byte) array[i]; }//from ww w . j a v a 2 s . co m return data; } }