Here you can find the source of intToFourByte(long value, byte[] dest, int off)
public static void intToFourByte(long value, byte[] dest, int off)
//package com.java2s; public class Main { private static final String ERR_VALUE_OOB = "Value out of bounds (%s)"; public static final long MAX_32BITS = 4294967295L; public static byte[] intToFourByte(long value) { byte[] buf = new byte[4]; intToFourByte(value, buf, 0);/*w w w .ja va 2 s. co m*/ return buf; } public static void intToFourByte(long value, byte[] dest, int off) { if ((value < 0) || (value > MAX_32BITS)) throw new IllegalArgumentException(String.format(ERR_VALUE_OOB, value)); dest[off + 0] = (byte) ((value & 0xFF000000L) >> 24); dest[off + 1] = (byte) ((value & 0x00FF0000L) >> 16); dest[off + 2] = (byte) ((value & 0x0000FF00L) >> 8); dest[off + 3] = (byte) ((value & 0x000000FFL)); } }