Here you can find the source of int2byte(int input)
public static byte[] int2byte(int input)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] int2byte(int input) { byte[] result = new byte[4]; for (int i = 0;; i++) { if (i >= 4) return result; result[i] = (byte) (0xFF & input >> i * 8); }/*from w w w.j ava 2 s. c o m*/ } }