Here you can find the source of intToBytes(int intValue)
public static byte[] intToBytes(int intValue)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] intToBytes(int intValue) { byte[] b = new byte[4]; for (int i = 0; i < 4; i++) { b[i] = (byte) (intValue >> 8 * (3 - i) & 0xFF); }//www.j a v a 2 s . c om return b; } }