Here you can find the source of intToByteArray(int value, byte[] dest)
public static void intToByteArray(int value, byte[] dest)
//package com.java2s; //License from project: Open Source License public class Main { public static void intToByteArray(int value, byte[] dest) { int lastIndex = dest.length - 1; for (int i = lastIndex; i >= 0; i--) { dest[i] = (byte) (value & 0xff); value = value >> 8;/*from w w w . ja v a 2 s.c om*/ } } }