Here you can find the source of convertIntToBytes(int i)
public static byte[] convertIntToBytes(int i)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] convertIntToBytes(int i) { byte[] b = new byte[4]; b[0] = (byte) (0xff & i); b[1] = (byte) ((0xff00 & i) >> 8); b[2] = (byte) ((0xff0000 & i) >> 16); b[3] = (byte) ((0xff000000 & i) >> 24); return b; }//from w ww. ja v a2 s . c o m }