Here you can find the source of int2Byte(int intValue)
public static byte[] int2Byte(int intValue)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] int2Byte(int intValue) { byte[] b = new byte[4]; for (int i = 0; i < 4; i++) { b[i] = (byte) (intValue >> 8 * (3 - i) & 0xFF); //System.out.print(Integer.toBinaryString(b[i])+" "); //System.out.print((b[i] & 0xFF) + " "); }// w w w . j a v a2 s . co m return b; } }