Here you can find the source of intToByteArray(int integer)
public static byte[] intToByteArray(int integer)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] intToByteArray(int integer) { return new byte[] { (byte) ((integer & 0xFF000000) >> 24), (byte) ((integer & 0x00FF0000) >> 16), (byte) ((integer & 0x0000FF00) >> 8), (byte) ((integer & 0x000000FF)) }; }//from w w w . j a v a 2s . c o m }