Here you can find the source of intToBytes(int n)
public static byte[] intToBytes(int n)
//package com.java2s; public class Main { public static byte[] intToBytes(int n) { byte[] b = new byte[4]; b[3] = (byte) (n >> 24); b[2] = (byte) (n >> 16); b[1] = (byte) (n >> 8); b[0] = (byte) (n >> 0); return b; }//from ww w . jav a2 s .c o m }