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